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# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoderPractice
{
    class Program
    {


        /// <summary>
        /// 順列 (n >= k)
        /// </summary>
        public static long nPk(long n, long k)
        {
            if (n < k) return 0;
            if (n == k) return 1;

            long x = 1;
            for (long i = 0; i < k; i++)
            {
                x = x * (n - i);
            }
            return x;
        }

        /// <summary>
        /// 組み合わせ (n >= k)
        /// </summary>
        public static long nCk(long n, long k)
        {
            if (n < k) return 0;
            if (n == k) return 1;

            long x = 1;
            for (long i = 0; i < k; i++)
            {
                x = x * (n - i) / (i + 1);
            }
            return x;
        }

        const string AZ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        static void Main(string[] args)
        {
            var r = "";
            var count = 0;
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 処理





            var ins = StandardInputToLongs();
            r = (nCk(ins[0], 2) + nCk(ins[1], 2)).ToString();






            // 処理

            Console.WriteLine($"{r}");

            // 処理終了
            Console.Out.Flush();
            Console.ReadKey();
        }


        public static decimal Sqrt(decimal x, decimal? guess = null)
        {
            var ourGuess = guess.GetValueOrDefault(x / 2m);
            var result = x / ourGuess;
            var average = (ourGuess + result) / 2m;

            if (average == ourGuess) // This checks for the maximum precision possible with a decimal.
                return average;
            else
                return Sqrt(x, average);
        }

        #region 標準処理ライブラリ
        /// <summary>
        /// 半角スペース区切りの標準入力を文字列のIListに変換します。
        /// </summary>
        /// <returns></returns>
        static public IList<string> StandardInputToStrings()
        {
            return Console.ReadLine().Split(' ').ToList();
        }

        /// <summary>
        /// stringを取得
        /// </summary>
        /// <returns></returns>
        static public string StandardInputToString()
        {
            return Console.ReadLine();
        }

        /// <summary>
        /// 半角スペース区切りの標準入力を文字列のIListに変換します。複数行に対応。
        /// </summary>
        /// <returns></returns>
        static public IList<IList<string>> MultipleStandardInputToStrings()
        {
            string line;
            var r = new List<List<string>>();
            do
            {
                line = Console.ReadLine();
                r.Add(line.Split(' ').ToList());
                line = Console.ReadLine();
            } while (line == null);

            return (IList<IList<string>>)r;
        }

        /// <summary>
        /// 半角スペース区切りの標準入力を数値のIListに変換します。
        /// </summary>
        /// <returns></returns>
        static public IList<long> StandardInputToLongs()
        {
            return Console.ReadLine().Split(' ').Select(n => long.Parse(n)).ToList();
        }
        /// <summary>
        /// 半角スペース区切りの標準入力を数値のIListに変換します。
        /// </summary>
        /// <returns></returns>
        static public long StandardInputToLong()
        {
            return long.Parse(Console.ReadLine());
        }

        /// <summary>
        /// 半角スペース区切りの標準入力を文字列のIListに変換します。複数行に対応。
        /// </summary>
        /// <returns></returns>
        static public IList<IList<long>> MultipleStandardInputToLongs()
        {
            string line;
            var r = new List<List<long>>();
            do
            {
                line = Console.ReadLine();
                r.Add(line.Split(' ').Select(n => long.Parse(n)).ToList());
                line = Console.ReadLine();
            } while (line == null);

            return (IList<IList<long>>)r;
        }

        /// <summary>
        /// 半角スペース区切りの標準入力を数値のIListに変換します。
        /// </summary>
        /// <returns></returns>
        static public IList<int> StandardInputToInts()
        {
            return Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToList();
        }
        /// <summary>
        /// 半角スペース区切りの標準入力を数値のIListに変換します。
        /// </summary>
        /// <returns></returns>
        static public int StandardInputToInt()
        {
            return int.Parse(Console.ReadLine());
        }

        /// <summary>
        /// 半角スペース区切りの標準入力を文字列のIListに変換します。複数行に対応。
        /// </summary>
        /// <returns></returns>
        static public IList<IList<int>> MultipleStandardInputToInts()
        {
            string line;
            var r = new List<List<int>>();
            do
            {
                line = Console.ReadLine();
                r.Add(line.Split(' ').Select(n => int.Parse(n)).ToList());
                line = Console.ReadLine();
            } while (line == null);

            return (IList<IList<int>>)r;
        }
    }






    public static class AtCoderResultExtentions
    {
        static public string AsDelimitedResult<T>(this IList<T> ie, string delimitter = " ")
        {
            return string.Join(delimitter, ie);
        }
    }
    #endregion
    #region List拡張
    public static class IListExtensions
    {


        public static IEnumerable<IEnumerable<T>> Perm<T>(this IEnumerable<T> items, int? k = null)
        {
            if (k == null)
                k = items.Count();

            if (k == 0)
            {
                yield return Enumerable.Empty<T>();
            }
            else
            {
                var i = 0;
                foreach (var x in items)
                {
                    var xs = items.Where((_, index) => i != index);
                    foreach (var c in Perm(xs, k - 1))
                        yield return c.Before(x);

                    i++;
                }
            }
        }
        public static IEnumerable<IEnumerable<T>> Comb<T>(this IEnumerable<T> items, int r)
        {
            if (r == 0)
            {
                yield return Enumerable.Empty<T>();
            }
            else
            {
                var i = 1;
                foreach (var x in items)
                {
                    var xs = items.Skip(i);
                    foreach (var c in Comb(xs, r - 1))
                        yield return c.Before(x);

                    i++;
                }
            }

        }

        // 要素をシーケンスに追加するユーティリティ
        public static IEnumerable<T> Before<T>(this IEnumerable<T> items, T first)
        {
            yield return first;

            foreach (var i in items)
                yield return i;
        }
        public static IList<T> Swap<T>(this IList<T> ie, int indexA, int indexB)
        {
            var temp = ie[indexA];
            ie[indexA] = ie[indexB];
            ie[indexB] = temp;
            return ie;
        }
    }
    #endregion
}