import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		int sum_n = 0;
		int sum_m = 0;

		if (N > 1 ){
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		}
		if (M > 1 ){
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		}

		System.out.println( sum_m + sum_n );

	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		int sum_n = 0;
		int sum_m = 0;

		if (N > 1 ){
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		}
		if (M > 1 ){
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		}

		System.out.println( sum_m + sum_n );

	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		int sum_n = 0;
		int sum_m = 0;

		if (N > 1 ){
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		}
		if (M > 1 ){
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		}

		System.out.println( sum_m + sum_n );

	} main {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		int sum_n = 0;
		int sum_m = 0;

		if (N > 1 ){
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		}
		if (M > 1 ){
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		}

		System.out.println( sum_m + sum_n );

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int M = scan.nextInt(); M scan.nextInt() scan.nextInt scan int sum_n = 0; sum_n 0 int sum_m = 0; sum_m 0 if (N > 1 ){
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		} N > 1 N 1 {
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		} for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			} int i = N-1; int i = N-1; i N-1 N 1 i > 0 i 0 i-- i-- i {
				sum_n += i ;
			} {
				sum_n += i ;
			} sum_n += i sum_n i if (M > 1 ){
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		} M > 1 M 1 {
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		} for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			} int i = M-1; int i = M-1; i M-1 M 1 i > 0 i 0 i-- i-- i {
				sum_m += i ;
			} {
				sum_m += i ;
			} sum_m += i sum_m i System.out.println( sum_m + sum_n ) System.out.println System.out System System.out sum_m + sum_n sum_m sum_n String[] args args public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		int sum_n = 0;
		int sum_m = 0;

		if (N > 1 ){
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		}
		if (M > 1 ){
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		}

		System.out.println( sum_m + sum_n );

	}
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		int sum_n = 0;
		int sum_m = 0;

		if (N > 1 ){
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		}
		if (M > 1 ){
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		}

		System.out.println( sum_m + sum_n );

	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		int sum_n = 0;
		int sum_m = 0;

		if (N > 1 ){
			for (int i = N-1; i > 0; i-- ){
				sum_n += i ;
			}
		}
		if (M > 1 ){
			for (int i = M-1; i > 0; i-- ){
				sum_m += i ;
			}
		}

		System.out.println( sum_m + sum_n );

	}
}