a = int(input())
b = int(input())
if (a>b):
    dis = (a-b)
#     if dis==2:
#         ;
    if dis%2==1:
        dis = (int)(dis/2)
        dis = dis*(dis+1) + (dis+1)
    else:
        dis = (int)(dis/2)
        dis = dis*(dis+1)
else:
    dis = b-a
#     if dis==2:
#         ;
    if dis%2==1:
        dis = (int)(dis/2)
        dis = dis*(dis+1) + (dis+1)
    else:
        dis = (int)(dis/2)
        dis = dis*(dis+1)
print(dis)