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-----
2 1

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

Solutions:

x,y = list(map(int,input().split()))

print((int((x * (x-1)) / 2  + (y * (y - 1))/2)))


n, m = list(map(int, input().split()))
ln = []
ans = 0
for i in range(n):
    ln.append(2)
for i in range(m):
    ln.append(3)
for a in range(len(ln)):
    for b in range(len(ln)):
        if a != b:
            if (ln[a]+ln[b]) % 2 == 0:
                ans += 1
print((ans//2))


from scipy.special import comb

n, m = map(int, input().split())
print(int(comb(n, 2) + comb(m, 2)))

import math

n, m = list(map(int, input().split()))


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


if n >= 2 and m >= 2:
    ans = combinations_count(m, 2) + combinations_count(n, 2)
elif n < 2 and m < 2:
    ans = 0
elif n < 2:
    ans = combinations_count(m, 2)
elif m < 2:
    ans = combinations_count(n, 2)


print(ans)


n, m = list(map(int, input().split()))

print((n*(n-1)//2+(m*(m-1)//2)))


n,m = list(map(int,input().split()))
  
print((int(n * (n-1) / 2 + m * (m - 1) / 2)))


N, M= map(int, input().split())
ans = (N+M)*(N+M-1)//2 - N*M
print(ans)

N,M=map(int,input().split())

c = (N+M)*(N+M-1)/2 - N*M

print(int(c))

a,b=map(int,input().split());print(a*(a-1)//2+b*(b-1)//2)

import math
N,M=map(int,input().split())
print((M+N)*(M+N-1)//2-M*N)

N, M = list(map(int, input().split()))

print((N * (N - 1) // 2 + M * (M - 1) // 2))


import math
def combinations_count(n, r):
	if n < 2:
		return 0
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n, m = [int(i) for i in input().split()]
print(combinations_count(n, 2) + combinations_count(m, 2))

n, m = map(int, input().split())

ans = n * (n - 1) // 2 + m * (m - 1) // 2
print(ans)

n, m = list(map(int, input().split()))
print((n * (n - 1) // 2 + m * (m - 1) // 2))


import itertools
n, m = list(map(int, input().split()))
ln = []
ans = 0
for i in range(n):
    ln.append(2)
for i in range(m):
    ln.append(3)
for x in itertools.combinations(ln, 2):
    if (x[0]+x[1]) % 2 == 0:
        ans += 1
print(ans)


n, m = list(map(int, input().split()))

ans = 0

if n == 0:
    print((int(m * (m - 1) / 2)))
    return

if m == 0:
    print((int(n * (n - 1) / 2)))
    return

ans = (n * (n - 1) / 2) + (m * (m - 1) / 2)
print((int(ans)))


n, m = map(int, input().split())

ans = int(n * (n - 1) / 2 + m * (m - 1) / 2)
print(ans)

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if n <= 1: return 0
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N, M = map(int, input().split())

print(cmb(N,2)+cmb(M,2))

def factorial(n):
    ans = 1
    for i in range(1,n+1):
        ans *= i
    return ans

def combination(n,r):
    return factorial(n)//(factorial(n-r)*factorial(r))

N,M = map(int,input().split())

print(combination(N,2)+combination(M,2))

a = list(map(int, input().rstrip().split()))
out=0
for i in a:
    if i > 1:
        out += i*(i-1)//2
print(out)


N,M = map(int,input().split())
print((N*(N-1)//2)+(M*(M-1)//2))

import numpy as np
#n = int(input())
a = list(map(int, input().rstrip().split()))
out=0
for i in a:
    if i > 1:
        out += i*(i-1)//2
print(out)


from scipy.special import comb
N,M = input().split()
N = int(N)
M = int(M)

A = 0
B = 0
if N >= 2 :
  A = comb(N, 2, exact=True)

if M >= 2 :
  B = comb(M, 2, exact=True)
 
print(A + B)

import math
n,m=map(int,input().split())
 
 
def combinations_count(a, b):
  if a!=0 and a!=1:
    return math.factorial(a) // (math.factorial(a - b) * math.factorial(b))
  else:
    return 0
 
print(combinations_count(n, 2)+combinations_count(m,2))

N, M = list(map(int, input().split()))
print(N*(N-1)//2 + M*(M-1)//2)

import itertools
N,M = map(int,input().split())
ball = list(range(2,2*N+1,2))+list(range(1,2*M,2))
count=0
for i,j in list(itertools.combinations(ball,2)):
  	if (i+j)%2==0:count+=1
print(count)

# coding: utf-8
# Your code here!
[n,m] = input().split()
n = int(n)
m = int(m)

sum_n = 0
sum_m = 0

for i in range(n):
    sum_n += i
    
for j in range(m):
    sum_m += j
    
print(sum_n+sum_m)

from operator import mul
from functools import reduce
def cmb(n,r):
    over=reduce(mul,range(n,n-r,-1))
    under=reduce(mul,range(1,r+1))
    return over//under

N,M=map(int,input().split())
if N<=1:
    C=0
else:
    C=cmb(N,2)
if M<=1:
    D=0
else:
    D=cmb(M,2)
    
print(C+D)

n,m = map(int,input().split())
import math

a = (n * (n - 1)) / 2

b = (m * (m - 1)) / 2

print(math.floor(a + b))

N,M = map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)

n, m = map(int, input().split())
print((n+m)*(n+m-1)//2-n*m)

N,M = map(int,input().split())
cnt = 0
if N >= 2:
    cnt += (N*(N-1))/2
if M >= 2:
    cnt += (M*(M-1))/2

print(int(cnt))

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, M = na()
print((N * (N - 1) // 2 + M * (M - 1) // 2))




import  math
a=list(map(int,input().split()))
if a[0]==1 and a[1]==1:
    print((0))
    
elif a[0] == 0 or a[0]== 1:
    b = math.factorial(a[1])/((math.factorial(2)*math.factorial(a[1]-2)) )
    print((int(b)))  
   
    
elif a[1]== 0  or a[1]== 1:
    b = math.factorial(a[0])/((math.factorial(2)*math.factorial(a[0]-2)))
    print((int(b)))
    
    
else:
    b = math.factorial(a[1])/((math.factorial(2)*math.factorial(a[1]-2)) )
    c = math.factorial(a[0])/((math.factorial(2)*math.factorial(a[0]-2)))
    print((int(b+c)))


import math
import sys
##### graph implementation with adjacancy list#####
class Graph:
    def __init__(self,Nodes,is_directed=False):
        self.nodes=Nodes
        self.adj_list={}
        self.is_directed=is_directed
 
        for node in self.nodes:
            self.adj_list[node]=[]
            
    def add_edge(self,u,v):
        self.adj_list[u].append(v)
        if self.is_directed==False:
            self.adj_list[v].append(u)
 
    def print_graph(self):
        for node in self.nodes:
            print((node,"->",self.adj_list[node]))
 
    def degree_node(self,node):
        return len(self.adj_list[node])
 
    def dfsUTIL(self,v,visited,parents=[]):
        #print(v,end=" ")
        visited[v]=True
        for i in self.adj_list[v]:
            if visited[i]==False:
                self.dfsUTIL(i,visited,parents)
                parents.append(i)        
    
    def dfs(self,v):
        visited=[False]*(max(self.adj_list)+1)
        parents=[v]
        self.dfsUTIL(v,visited,parents)
        return len(parents)
        
#####sorting a dictionary by the values#####
def dict_sort(ans):
    ans=sorted(list(ans.items()),reverse=True,key=lambda kv:(kv[1]))
    
##### naive method for testing prime or not O(n^.5)#####
def is_prime(n):
    if n==1:
        return 0
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True

#####swap function#####
def swap(a,b):
    temp=a
    a=b
    b=temp
    return a,b

#####Primes till Nth O(n)#####
def seive_primes(n):
    flag=[0]*(n+10)
    flag[1]=flag[0]=1
    i=2
    while i*i<=n+1:
        if flag[i]==0:
            j=i*i
            while j<=n+1:
                flag[j]=1
                j+=i
        i+=1
    return flag

#####all the prime factors of a number#####
def factors(n):
    d={}
    while(n%2==0):
        if 2 in d:
            d[2]+=1
        else:
            d[2]=1
        n/=2
    for i in range(3,int(n**0.5)+1,2):
        while(n%i==0):
            if i in d:
                d[i]+=1
            else:
                d[i]=1
            n/=i
    n=int(n)
    if n>1:
        d[n]=1
    return d

#####greatest common divisor of two numbers#####
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

#####least common multiplyer of two numbers#####
def lcm(a,b):
    return (a*b)//gcd(a,b)

#####function that return all the letters#####
def alphabates():
    return "abcdefghijklmnopqrstuvwxyz"

#####binary search O(logN)#####
def binary_search(ls,n,flag):
    low=0
    hi=n-1
    while(low<=hi):
        mid=(low+hi)//2
        if ls[mid]==flag:
            return mid
        elif ls[mid]>flag:
            hi=mid-1
        else:
            low=mid+1
    return -1

#####quadratic roots#####
def qdrt(a,b,c):
    chk=b*b-4*a*c
    if chk>=0:
        ans1=(-b+chk**0.5)/(2*a)
        ans2=(-b-chk**0.5)/(2*a)
        return [int(ans1),int(ans2)]
    return -1
#####permutations#####
def permutation(n,r):
    if n<r:
        return 0
    ans=1
    for i in range(n-r+1,n+1):
        ans*=i
    return ans

#####combinations#####
def combination(n,r):
    if n<r:
        return 0
    ans=1
    for i in range(r):
        ans*=(n-i)
    div=1
    for i in range(2,r+1):
        div*=i
    return ans//div
        
#####taking an array/list as input#####
def arinp():
    ls=list(map(int,input().split()))
    return ls

#####taking multiple inputs#####
def mult_inp():
    return list(map(int,input().split()))

#####Main function starts from here#####
def main():
    n,m=mult_inp()
    print((combination(n,2)+combination(m,2)))
def __starting_point():
    main()
    

    
    
    
            
    
    

__starting_point()

n, m = map(int, input().split())
print(n * (n - 1) // 2 + m * (m - 1) // 2)

a, b = map(int, input().split())
 
print(int(a*(a-1)/2+b*(b-1)/2))

n,m= map(int, input().split())
 
print(int(((n*(n-1))+m*(m-1))/2))

n, m = map(int, input().split())
print(int(n*(n-1)/2 + m*(m-1)/2))

def main():
    n, m = map(int, input().split())
    # nは偶数、mは奇数
    # n+mから2つ選ぶ選び方は
    # n:m = 0:2 和は 偶数、選び方はmC2
    # n:m = 1:1 和は 奇数 （今回はこれは含めない）
    # n:m = 2:0 和は 偶数、選び方はnC2
    cnt = 0
    if m >= 2:
        cnt += m * (m -1) // 2
    if n >=2:
        cnt += n * (n -1) // 2
    print(cnt)

def __starting_point():
    main()
__starting_point()

from scipy.special import comb
n,m=map(int, input().split())
print(comb(n,2,exact=True)+comb(m,2,exact=True))

N, M = map(int, input().split())

# Think about sets
all = (N+M) * (N+M-1) // 2
odd = N * M
print(all - odd)

n, m = map(int, input().split())
ans = 0
if n >= 2:
    ans += n*(n-1)//2
else:
    ans += 0

if m >= 2:
    ans += m*(m-1)//2
else:
    ans += 0

print(ans)

n, m = list(map(int,input().split()))

sum = n * (n - 1) / 2 + m * (m - 1) / 2 

print((int(sum)))


n, m = map (int, input().split())
ex1 = n*(n-1)//2
ex2 = m*(m-1)//2
ans = ex1 + ex2
print(ans)

print(sum(i*~-i//2for i in map(int,input().split())))

n, m = map(int, input().split())
print((n*max(n-1, 0)//2 + m*max(m-1, 0) // 2))

N,M = map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)

import math

def comb(n, r):
  if n <= 1:
    return 0
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N, M = list(map(int, input().split()))
print(comb(N+M, 2) - N*M )

import math
N,M=list(map(int, input().split()))

x=(N*(N-1)/2)+(M*(M-1)/2)

print((math.floor(x)))


N,M = map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)

n, m = list(map(int, input().split()))
print((m * (m - 1) // 2 + n * (n - 1) // 2))


n,m = map(int,input().split())
if n > 1:
    an = n*(n-1)/2
else:
    an = 0
if m>1:
    am = m*(m-1)/2
else:
    am = 0
print(int(an+am))

n,m=map(int,input().split())
print(int((n*(n-1)/2)+(m*(m-1)/2)))

n, m = map(int, input().split())
res = ((n*n)-n)//2+((m*m)-m)//2
print(res)

n,m = map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)

import math
N,M=map(int,input().split())
def C(x):
    if x>=2:
        return math.factorial(x)//(math.factorial(x-2)*2)
    else:
        return 0
print(C(N)+C(M))

n, m = map(int, input().split())
ans = n*(n - 1)/2 + m*(m - 1)/2
print(int(ans))

import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=list(map(int,input().split()))
if (n<=1) and (m<=1):
  ans=0
else:
  if n<=1:
    ans=comb(m,2)
  elif m<=1:
    ans=comb(n,2)
  else:
    ans=comb(n,2)+comb(m,2)
  
print(ans)


def resolve():
    n,m = map(int,input().split())
    print(int(n*(n-1)/2+m*(m-1)/2))

resolve()

n,m=map(int,input().split())
print(n*(n-1)//2 + m*(m-1)//2)

n, m = map(int, input().split())

ans = (n * (n-1) //2) + (m * (m-1) //2)
print(ans)

n, m = list(map(int, input().split()))

if n >= 2:
    even = n * (n-1) / 2
else:
    even = 0

if m >= 2:
    odd = m * (m-1) / 2
else:
    odd = 0

print((int(even+odd)))



inp=input().split()
n=int(inp[0])
m=int(inp[1])
arr=[]
pares=0
impares=0
count=1
nums=0

def binary(arr, menor, mayor, x): 
    if mayor >= menor: 
        med = (mayor + menor) // 2
        if arr[med] == x: 
            return med 

        elif arr[med] > x: 
            return binary(arr, menor, med - 1, x) 
  
        else: 
            return binary(arr, med + 1, mayor, x) 
    else: 
        return -1

while len(arr)<(m+n):
    if count%2==0 and pares<n:
        arr.append(count)
        pares+=1
    elif count%2!=0 and impares<m:
        arr.append(count)
        impares+=1
    count+=1
sums=[]


for x in arr:
   for y in arr:
        if(x+y)%2==0 and binary(sums, 0, len(sums)-1, [y,x])==-1 and x!=y:
            sums.append([x,y])
            nums+=1
print(nums)


from scipy.special import comb

n, m = list(map(int, input().split()))
if n <= 1:
  a = 0
else:
  a = comb(n, 2, exact = "true")
if m <= 1:
  b = 0
else:
  b = comb(m, 2, exact = "true")
print(a+b)

n, m = map(int, input().split())
print(n*(n-1)//2+m*(m-1)//2)

n,m = map(int,input().split())

ans = int(n*(n-1)/2 + m*(m-1)/2)
print(ans)

import math

n, m = list(map(int, input().split()))

def c(a, b):
    if a >= 2:
        return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))
    else:
        return 0
        

print((c(n, 2) + c(m, 2)))


n, m = map(int ,input().split())

x= n*(n-1)/2
z= m*(m-1)/2
print(int(x+z))

# 159 A
N,M = list(map(int, input().split()))
print((N*(N-1) + M*(M-1))//2)

N, M = list(map(int, input().split()))

ans = N*(N-1)//2 + M*(M-1)//2
print(ans)


def main():
    N, M = tuple([int(_x) for _x in input().split()])
    print((N*(N-1)//2 + M*(M-1)//2))


main()


N,M=map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)

def main():
    n,m = map(int, input().split())
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            cnt +=1
    
    for i in range(m):
        for j in range(i+1, m):
            cnt +=1
    return cnt

def __starting_point():
    print(main())
__starting_point()

from math import floor
n,m = list(map(int,input().split()))
a =(n*(n-1))/2
b =(m*(m-1))/2
print((floor(a+b)))


n, m = list(map(int, input().split()))
print((n * (n - 1) // 2 + m * (m - 1) // 2))


N, M = map(int, input().split())
x = N + M
print(x * (x - 1) // 2 - N * M)

#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    T=N+M
    T=((T*(T-1))/2)
    return print(int(T-M*N))


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

def __starting_point():
    main()
__starting_point()

[N, M] = [int(i) for i in input().split()]
print(int(N*max(N-1, 0)/2) + int(M*max(M-1, 0)/2))

import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n, m = inl()
    return n * (n - 1) // 2 + m * (m - 1) // 2


print(solve())


n, m = map(int, input().split())

ans = int((n*(n-1)/2) + (m*(m-1)/2))
print(ans)

n,m = map(int,input().split())
print((n*(n-1))//2 + (m*(m-1))//2)

n, m = list(map(int, input().split()))
print((n*(n-1)//2 + m*(m-1)//2))


N, M = list(map(int, input().split()))

if N < 2:
    guusuu = 0
else:
    guusuu = N * (N - 1) / 2

if M < 2:
    kisuu = 0
else:
    kisuu = M * (M - 1) / 2

print(int(guusuu + kisuu))

m,n=map(int,input().split())
print(m*(m-1)//2+n*(n-1)//2)

N,M=list(map(int,input().split()))
print((N*(N-1)//2+M*(M-1)//2))


n,m=map(int,input().split())
print(n*(n-1)//2+m*(m-1)//2)

N,M = list(map(int,input().split()))

ki = (N*(N-1))//2
gu = (M*(M-1))//2

print((ki+gu))


N, M = list(map(int, input().split()))
print(N*(N-1)//2 + M*(M-1)//2)

N, M = map(int, input().split())
ans = N*(N-1)//2 + M*(M-1)//2
print(ans)

a=input("")
lista=a.split()
lista2=[]
par=0
impar=-1
contador=0
for i in range (int(lista[0])):
  par+=2
  lista2.append(par)
for i in range (int(lista[1])):
  impar+=2
  lista2.append(impar)
longitud=len(lista2)-1

for i in range (0,len(lista2)):
  b=i
  while True:
    if b+1>longitud:
      break 
    else: 
      suma=lista2[i]+lista2[b+1]
      b=b+1
      if suma%2==0:
        contador+=1
      
print(contador)


import itertools
n,m=map(int,input().split())
i = [2]*n
j = [2]*m
p = list(itertools.combinations(i, 2))
q = list(itertools.combinations(j, 2))
print(len(p)+len(q))

N,M=map(int,input().split())
#----------以上入力----------
print (int(N*(N-1)/2+M*(M-1)/2))

import os, sys, re, math

(N, M) = [int(n) for n in input().split()]

cn = (N * (N - 1)) // 2
cm = (M * (M - 1)) // 2
print((cn + cm))


N, M = [int(s) for s in input().split(' ')]
print(((N * (N - 1) + M * (M - 1)) // 2))


n,m = map(int,input().split())
ans = 0
def com2(x):
  return x*(x-1)//2
if n >= 2:
  ans += com2(n)
if m >= 2:
  ans += com2(m)
print(ans)

n,m = map(int,input().split())
print(n*(n-1)//2 + m*(m-1)//2)

N, M = map(int, input().split())
ans = (N+M)*(N+M-1)//2 - (N*M)
print(ans)

n,m = list(map(int,input().split()))
ans = 0
if(n >= 2):
    ans += n*(n-1)//2
    
if(m >= 2):
    ans += m*(m-1)//2
print(ans)


a,b=map(int,input().split())
print(a*(a-1)//2+b*(b-1)//2)