import sys
eng = {'A': 10,'B': 11,'C': 12,'D': 13,'E': 14,'F': 15,'G': 16,'H': 17,
'I': 34,'J': 18,'K': 19,'L': 20,'M': 21,'N': 22,'O': 35,'P': 23,
'Q': 24,'R': 25,'S': 26,'T': 27,'U': 28,'V': 29,'W': 32,'X': 30,'Y': 31,'Z': 33}
mul = [8,7,6,5,4,3,2,1]
for line in sys.stdin:
sum = 0
out = ''
for i in range(0,8):
sum = sum + int(line[i]) * mul[i]
for i in range(0,len(eng)):
t = sum
tt = str(list(eng.values())[i])
t = t + int(tt[0]) * 1 + int(tt[1]) * 9
if int(line[8]) == 10 - (t % 10) :
out = out + str(list(eng.keys())[i])
print(out)