import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); long N = in.nextLong(); long M = in.nextLong(); long x=N-1; long y=M-1; long y_cut = 1; long x_cut = 1; long cut=0; while(x>0 && y>0){ if(x>y){ x--; x_cut++; cut += y_cut; }else{ y--; y_cut++; cut += x_cut; } } cut =cut+ x*y_cut + y*x_cut; System.out.println(cut); } }