Tasnim comes to visit Dinajpur which is very famous for litchi production. Today, she comes to a lit…

Click here to read the complete problem statement.

If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

Tasnim comes to visit Dinajpur which is very famous for litchi production. Today, she comes to a litchi orchard and notices a strange thing. The orchard owner placed the litchis into some different sizes of buckets arranged in a row in such a way that every next bucket contains exactly one more litchi than the previous one. She also learns that the smallest bucket contains exactly M litchis and the largest one contains exactly N litchis. Tasnim is very curious to know the total number of litchis that all the buckets have. But, she is not so expert in mathematics. Moreover, she also doesn’t know how many buckets are there. So, she is asking for your help. Now, your task is to help Tasnim to determine the number of buckets and also the total number of litchis that the buckets contain.

Let me give you an example, the smallest bucket has exactly 5 litchis and the largest one has exactly 11. So, there are 5 + 6 + 7 + 8 + 9 + 10 + 11 = 56 litchis in total in 7 buckets.

Input

There will be multiple test cases in each input file where each test case contains two integers, M and N (0 < M ≤ N ≤ 108), denoting the number of litchis in the smallest and largest bucket respectively.

Input file will be terminated when M and N both equal to zero (i.e. M is 0 and N is 0) and each input file will contain at most 100 test cases.

Output

For each case, print the number of buckets and the total number of litchis separated by a space. Don’t forget to print a blank line for each test case.

This usually means your submission doesn’t solve the problem efficiently enough. Please check the limits mentioned in the problem statment and the factors that are applied to the programming language you are using.

run=True
while run:
M,N=input().split()
m=int(M)
n=int(N)
if m==0 and n==0:
run=False
break
sum=0
for i in range(m,n+1):
sum=sum+i
sum2=n-m+1
print(str(sum2)+" "+str(sum))

Your code has taken too long time to complete running.Because you have used for loop to solve it .You should use mathematical formula to solve it in stead of for loop.