while True:
a = input()
if a=='0':
break
c = list(map(int,list(a)))
b = sum(c)
if b%9==0:
print(f"{a} is a multiple of 9 and has 9-degree {len(str(b))}.")
else:
print(f"{a} is not a multiple of 9.")
# JalenLam_progamer