h,w=map(int,input().split())
if w == 1 and h == 1:
    print(1)
elif h==1 or w==1:
    s=h*w*2
    for n in range(2,max(h,w)):
        s+=n*min(h,w)
    print(s)
elif h==2 and w==2:
    print(12)
elif h==w:
    s=h*h*w
    for n in range(2,max(h,w)):
        s+=n*min(h,w)
    print(s)
else:
    s=h*w*3
    for n in range(2,max(h,w)):
        s+=n*min(h,w)
    print(s)
