A - The Number of Even Pairs 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 100

問題文

N+M 個のボールがあります。各ボールには整数が 1 つ書かれています。
これらのボールに書かれている数について、

  • N 個のボールに書かれている数は偶数
  • M 個のボールに書かれている数は奇数

であることがわかっています。

これらの N+M 個のボールの中から 2 つ選んで、書かれた数の和が偶数になる方法の数を求めてください。選ぶ順序は考慮しません。

なお、この方法の数はボールに書かれている整数の実際の値によらないことが示せます。

制約

  • 0 \leq N,M \leq 100
  • 2 \leq N+M
  • 入力はすべて整数である。

入力

入力は以下の形式で標準入力から与えられる。

N M

出力

答えを出力せよ。


入力例 1

2 1

出力例 1

1

例えば 3 つのボールに書かれている数がそれぞれ 1,2,4 であるとすると、

  • 1 が書かれたボールと 2 が書かれたボールを選ぶと、和は奇数
  • 1 が書かれたボールと 4 が書かれたボールを選ぶと、和は奇数
  • 2 が書かれたボールと 4 が書かれたボールを選ぶと、和は偶数

であるので、答えは 1 です。


入力例 2

4 3

出力例 2

9

入力例 3

1 1

出力例 3

0

入力例 4

13 3

出力例 4

81

入力例 5

0 3

出力例 5

3

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