#include<iostream>
#include<math.h>
#include<string>
using namespace std;
int main(){
string in;
while(cin>>in){
int total=0;
for(int i=0;i<8;i++){
int x=in[i]-48;
total+=x*(8-i);
}
int ide=0;
ide=in[8]-48;
ide=10-ide;
int out[26]={10,11,12,13,14,15,16,17,34,18,19,20,21,22,35,23,24,25,26,27,28,29,32,30,31,33};
string out_str="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(int i=0;i<26;i++){
int x=out[i]/10;
int y=out[i]-(10*x);
int total_1=total+x+(9*y);
int ide_1=total_1%10;
if(ide_1==ide){
cout<<out_str[i];
}
}
cout<<endl;
}
}