#yuki799 a,b,c,d=map(int,raw_input().split()) res=0 for i in xrange(a,b+1): for j in xrange(c,d+1): if i!=j: res+=1 print res