from math import *n=int(input())for i in range(1,n+1): a,b=int(input()),int(input()) s=0 for v in range(ceil(a**0.5),floor(b**0.5)+1): s+=v**2 print(f"Case {i}: {s}")