https://www.acmicpc.net/problem/1292
n,m=map(int,input().split())
num=0
a=0
count=0
i=1
while 1:
count+=i
a+=i*i
if n-count-1<=i and n!=1:
num-=a
num-=(n-count-1)*(i+1)
n=10000
if m-count-1<=i:
num+=a
num+=(m-count)*(i+1)
break
i+=1
print(num)