import java.util.Scanner;
/**
 * @author yamato
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static int C(int a, int b) {
		b = Math.min(a-b,b);
		if (a==0||a==1)return 0;
		if (a==2)return 1;
		if (b==0)return 0;
		int i;
		int up = 1;
		for(i=0;i<b;i++) {
			up *= a-i;
		}
		int down = 1;
		for(i=1;i<=b;i++) {
			down *= i;
		}
		return up/down;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int ans = (C(n,2))+C(m,2);
		
		System.out.println(ans);
		
	}

} import java.util.Scanner; Scanner java.util public class Main {

	/**
	 * @param args
	 */
	public static int C(int a, int b) {
		b = Math.min(a-b,b);
		if (a==0||a==1)return 0;
		if (a==2)return 1;
		if (b==0)return 0;
		int i;
		int up = 1;
		for(i=0;i<b;i++) {
			up *= a-i;
		}
		int down = 1;
		for(i=1;i<=b;i++) {
			down *= i;
		}
		return up/down;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int ans = (C(n,2))+C(m,2);
		
		System.out.println(ans);
		
	}

} Main /**
	 * @param args
	 */
	public static int C(int a, int b) {
		b = Math.min(a-b,b);
		if (a==0||a==1)return 0;
		if (a==2)return 1;
		if (b==0)return 0;
		int i;
		int up = 1;
		for(i=0;i<b;i++) {
			up *= a-i;
		}
		int down = 1;
		for(i=1;i<=b;i++) {
			down *= i;
		}
		return up/down;
	} C {
		b = Math.min(a-b,b);
		if (a==0||a==1)return 0;
		if (a==2)return 1;
		if (b==0)return 0;
		int i;
		int up = 1;
		for(i=0;i<b;i++) {
			up *= a-i;
		}
		int down = 1;
		for(i=1;i<=b;i++) {
			down *= i;
		}
		return up/down;
	} b = Math.min(a-b,b) b Math.min(a-b,b) Math.min Math a-b a b b if (a==0||a==1)return 0; a==0||a==1 a==0 a 0 a==1 a 1 return 0; 0 if (a==2)return 1; a==2 a 2 return 1; 1 if (b==0)return 0; b==0 b 0 return 0; 0 int i; i int up = 1; up 1 for(i=0;i<b;i++) {
			up *= a-i;
		} i=0; i=0 i 0 i<b i b i++ i++ i {
			up *= a-i;
		} {
			up *= a-i;
		} up *= a-i up a-i a i int down = 1; down 1 for(i=1;i<=b;i++) {
			down *= i;
		} i=1; i=1 i 1 i<=b i b i++ i++ i {
			down *= i;
		} {
			down *= i;
		} down *= i down i return up/down; up/down up down int a a int b b public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int ans = (C(n,2))+C(m,2);
		
		System.out.println(ans);
		
	} main {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int ans = (C(n,2))+C(m,2);
		
		System.out.println(ans);
		
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner int ans = (C(n,2))+C(m,2); ans (C(n,2))+C(m,2) (C(n,2)) C n 2 C(m,2) C m 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	/**
	 * @param args
	 */
	public static int C(int a, int b) {
		b = Math.min(a-b,b);
		if (a==0||a==1)return 0;
		if (a==2)return 1;
		if (b==0)return 0;
		int i;
		int up = 1;
		for(i=0;i<b;i++) {
			up *= a-i;
		}
		int down = 1;
		for(i=1;i<=b;i++) {
			down *= i;
		}
		return up/down;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int ans = (C(n,2))+C(m,2);
		
		System.out.println(ans);
		
	}

} public class Main {

	/**
	 * @param args
	 */
	public static int C(int a, int b) {
		b = Math.min(a-b,b);
		if (a==0||a==1)return 0;
		if (a==2)return 1;
		if (b==0)return 0;
		int i;
		int up = 1;
		for(i=0;i<b;i++) {
			up *= a-i;
		}
		int down = 1;
		for(i=1;i<=b;i++) {
			down *= i;
		}
		return up/down;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int ans = (C(n,2))+C(m,2);
		
		System.out.println(ans);
		
	}

} Main
import java.util.Scanner;
/**
 * @author yamato
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static int C(int a, int b) {
		b = Math.min(a-b,b);
		if (a==0||a==1)return 0;
		if (a==2)return 1;
		if (b==0)return 0;
		int i;
		int up = 1;
		for(i=0;i<b;i++) {
			up *= a-i;
		}
		int down = 1;
		for(i=1;i<=b;i++) {
			down *= i;
		}
		return up/down;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int ans = (C(n,2))+C(m,2);
		
		System.out.println(ans);
		
	}

}