import math
def main():
    o=input()
    j=input()
    a,b=min(o,j),max(o,j)
    k=[1000000]*1001
    for i in xrange(a-1,b):
        p=(i-a+1)
        q=(b-1-i)
        k[i]=(p*(p+1)+q*(q+1))/2
    print min(k)
    
    
        
        
        
        
main()