import math
def func1(func1a):
func1_S1=set()
for func1_r_i in range(1,int(math.sqrt(func1a))+1):
if func1a%func1_r_i==0:
func1_S1.add(func1_r_i)
func1_S1.add(func1a//func1_r_i)
return list(func1_S1)
a=1
while 1:
b=int(input())
D1={}
L1=[]
if b==0:
break
for r_i in range(1,b+1):
D1[sum(func1(r_i))]=max(func1(r_i))
L1.append(sum(func1(r_i)))
if b in L1:
print("Case {}: {}".format(a,D1[b]))
else:
print("Case {}: {}".format(a,-1))
a+=1
while 1:
print("Hasan and Hussein (哈珊and海珊)")