Dole Out Cadbury



def f(a,b):

     if a and b:

         return a//b+f(a%b,b) if a>b else b//a+f(a,b%a)

     return 0

 p,q,r,s=map(int,input().split())

 t=0

 for i in range(p,q+1):

     for j in range(r,s+1):

         t+=f(i,j)

 print(t)

Post a Comment

0 Comments