public class a020{
public static void main(String[] args) {
java.util.Scanner scanner = new java.util.Scanner(System.in);
String[] en= {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
int[] ma= {10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33};
String[] in=new String[10];
int ten,zero,all=0;
for(int i=0;i<10;i++) {
in[i]=scanner.next();
for(int j=0;j<25;j++) {
if(in[0]==en[j]) {
ten=ma[j]/10;
zero=ma[j]%10;
all=ten+zero*9;
System.out.print(all);
}
}
}
}
}