Problem:
Score : 100 points

Problem Statement

We have N+M balls, each of which has an integer written on it.

It is known that:

The numbers written on N of the balls are even.

The numbers written on M of the balls are odd.

Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.

It can be shown that this count does not depend on the actual values written on the balls.

Constraints

0 \leq N,M \leq 100

2 \leq N+M

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N M

Output

Print the answer.

Sample Input 1

2 1

Sample Output 1

1

For example, let us assume that the numbers written on the three balls are 1,2,4.

If we choose the two balls with 1 and 2, the sum is odd;

If we choose the two balls with 1 and 4, the sum is odd;

If we choose the two balls with 2 and 4, the sum is even.

Thus, the answer is 1.

Sample Input 2

4 3

Sample Output 2

9

Sample Input 3

1 1

Sample Output 3

0

Sample Input 4

13 3

Sample Output 4

81

Sample Input 5

0 3

Sample Output 5

3

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
//........................</HEADER>................................
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
//........................</CONSTANT DEFINE>........................
const unsigned int MOD = 1000000007;
#define ll long long
#define Imax 1e9+5
#define LLmax 1e18
#define Imin -1e9-5
#define LLmin -1e18
#define PI acos(-1.0)
#define EPS 1e-9
#define INF 1<<28

//........................</LOOP >.................................
#define loop(i,a,b) for(int i=a;i<=b;i++)
#define rloop(i,a,b) for(int i=b;i>=a;i--)

//................</ STANDARTD TEMPLATE LIBRARY>...................
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair((a),(b))

//........................</ TYPE CONVERSION>......................
#define toRad(a) ((a)*(PI)/180)
#define toDeg(a) ((a)*180/(PI))

//........................</ MATH>.................................
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sq(a) ((a)*(a))
inline bool isEq(double a,double b){
    return (abs(a-b)<EPS);
}
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}

//........................</ ARRAY DEFAULT>........................
#define mem(a,v) memset(a,v,sizeof(a))
string day [] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
int month[]={31,28,31,30,31,30,31,31,30,31,30,31};  //Not Leap Year

//........................</DIRECTION>.............................
int dx4[]={1,0,-1,0};
int dy4[]={0,1,0,-1}; //4 Direction

int dx8[]={1,1,0,-1,-1,-1,0,1};
int dy8[]={0,1,1,1,0,-1,-1,-1};//8 direction

int dxh[]={2,1,-1,-2,-2,-1,1,2};
int dyh[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction (horse)

//........................</ INPUT/OUTPUT>.........................
#define read(n) scanf("%d",&n)
#define readll(n) scanf("%lld",&n)
#define read2(n,m) scanf("d",&n,&m)
#define read3(n,m,w) scanf("d%d",&n,&m,&w)
#define read2ll(n,m) scanf("lld",&n,&m)
#define write(n) printf("%d\n",n)
#define write2(n,m) printf("%d %d\n",n,m)
#define newline '\n'
#define PRECISION(x) cout << fixed << setprecision(x);
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//.......................</ PRE DEFINED FUNCTIONS>..............................
bool sortByFirst(const pair<int,int>&a,const pair<int,int>&b){
    return a.first>b.first;
}
vector <string> v;
void dfs (string str, string t = "", int cnt = 0) {
    if (cnt == 2) {
        v.push_back (t);
        return;
    } else {
        for (int i = 0; i <str.size (); i ++) {
            dfs (str, t + str [i], cnt + 1);
        }
    }
}
vector<vector<int> >divisor(100005);
void divisors(){
    for(int i=1;i<100005;i++){
        for(int j=i;j<100005;j+=i){
           divisor[j].push_back(i);
        }
    }
}

int main () {
    FAST_IO
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n,m;
    while(cin>>n>>m){
        cout<<n*(n-1)/2 + m*(m-1)/2<<endl;
    }
    return 0;
}