from typing import List, Dict

def solve() -> None:
    n, m = map(int, input().split())
    answer = 0
    mn = -1
    while n > 1 or m > 1:
        mn = min(n, m)
        answer += n * m
        answer += ((mn + 1) * mn) // 2 + (mn - 1)
        if n > m:
            n -= 1
        else:
            m -= 1
    print(answer + 1)

def main() -> None:
    t = 1
    while t > 0:
        solve()
        t -= 1

if _name_ == "_main_":
    main()
