mp = {}

def f(n, m):
    if (n, m) in mp:
        return mp[(n, m)]
    if n == 1 and m == 1:
        mp[(n, m)] = 1
        return 1
    if n > m:
        mp[(n, m)] = f(n-1, m) + f(1, m) + n * m
    else:
        mp[(n, m)] = f(n, m-1) + f(n, 1) + n * m
    return mp[(n, m)]

if __name__ == "__main__":
    n, m = map(int, input().split())
    result = f(n, m)
    print(result)
