import java.util.*; public class DN01_63230317 { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); if (b < a) { a += b; b = a-b; a -= b; } System.out.println((a-1)*(a*b)-(a-1)*a/2*(a+b)+(a-1)*a*(2*(a-1)+1)/6); } }