dp = []

for i in range(1000005):
  dp.append(0)

a, b = map(int, input().split())

if (a > b):
    a, b = b, a

dp[1] = 1

i = 2

while (i <= a):
  dp[i] = dp[i - 1] + 1 + i
  i += 1


res = 0;
cur = a * b;

i = 1
while (i <= b - a):

  res += dp[a]
  res += cur
  cur -= a
  i += 1

i = a
while (i >= 2):
  res += pow(i, 2)
  res += dp[i]
  res += i * (i - 1)
  res += dp[i - 1]
  i -= 1

res += 1

print(res)
