a=int(input())
b=[]
for i in range(a):
b.append([0,0,0])
b[i][0]+=int(input())
b[i][1]+=int(input())
def e(a,b,c):
print("Case {}: ".format(c+1),end="")
su=0
for i in range(a,b+1):
if i%(i**0.5)<=10e-7:
su+=i
print(su)
return 0
for i in range(a):
e(b[i][0],b[i][1],i)