//code by RiKang, weeklyps.com
#include <stdio.h>
#include <string.h>
char color[10][10]={"black","brown","red","orange","yellow","green","blue","violet","grey","white"};
int v;
int val(char *s){ // 값을 반환
for(int i=0; i<10 ;i++){
if(strcmp(color[i],s)==0)
return i;
}
return 0;
}
void mul(char *s){ // 곱을 출력
for(int i=0; i<10 ;i++){
if(strcmp(color[i],s)==0)
break;
printf("0");
}
}
int main() {
char a[9];
scanf("%s",a);
v = val(a);
scanf("%s",a);
v = 10*v + val(a);
printf("%d",v);
scanf("%s",a);
if(v!=0)
mul(a);
return 0;
}