**big, small = input().split()
big, small = int(big),int(small)
if big>= small:
    print((big**3)-(small**3))
else:
    print((small**3)-(big**3))**