n, m = map(int, input().split())
if n == m == 1:
    print(1)
elif n == 1 and m == 2 or m == 1 and n == 2:
    print(4)
elif n == m and n%2==0 and m % 2 == 0:
    print(m*n*(n+1))
elif n == m and n%2!=0 and m % 2 != 0:
    print(m*n*(n+1) + 3)
else:
    print(n*m*(max(n,m))+min(n,m)**2)