#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int main() {
int i, c = 0x00, ls, la, k = 0, d[8];
char y[8], x[8], s[100], a[100];
y[0] = 'm'; x[0] = 'a';
y[1] = 'f'; x[1] = 'e';
y[2] = 'c'; x[2] = 'l';
y[3] = 'd'; x[3] = 'u';
y[4] = 'h'; x[4] = 'a';
y[5] = 'n'; x[5] = 'h';
y[6] = 't'; x[6] = 'r';
y[7] = 's'; x[7] = 'k';
for (i = 0; i < 8; i++) {
d[i] = 0;
}
fgets(s, 100, stdin);
ls = strlen(s);
for (i = 0; i < ls; i++) {
if (s[i] == ' ') {
k--;
}
if (s[i] != ' ') {
a[k] = s[i];
}
k++;
}
la = 2 * (ls - 2) / 3 + 2;
for (i = 0; i < la; i = i + 2) {
if ((a[i] == y[0]) && (a[i + 1] == x[0])) {
d[0] = 1;
}
if ((a[i] == y[2]) && (a[i + 1] == x[2])) {
d[1] = 1;
}
if ((a[i] == y[4]) && (a[i + 1] == x[4])) {
d[2] = 1;
}
if ((a[i] == y[6]) && (a[i + 1] == x[6])) {
d[3] = 1;
}
if ((a[i] == 'b') && (a[i + 1] == 'k')) {
d[4] = 1;
d[5] = 1;
}
if ((a[i] == 'b') && (a[i + 1] == 'w')) {
d[4] = 0;
d[5] = 1;
}
if ((a[i] == 'r') && (a[i + 1] == 'd')) {
d[4] = 1;
d[5] = 0;
}
if ((a[i] == 'b') && (a[i + 1] == 'n')) {
d[4] = 0;
d[5] = 0;
}
if ((a[i] == 'd') && (a[i + 1] == 'a')) {
d[6] = 1;
d[7] = 1;
}
if ((a[i] == 'g') && (a[i + 1] == 'y')) {
d[6] = 0;
d[7] = 1;
}
if ((a[i] == 'g') && (a[i + 1] == 'e')) {
d[6] = 1;
d[7] = 0;
}
if ((a[i] == 'b') && (a[i + 1] == 'u')) {
d[6] = 0;
d[7] = 0;
}
}
if (d[0] == 1) {
c = c + 0x01;
}
if (d[1] == 1) {
c = c + 0x02;
}
if (d[2] == 1) {
c = c + 0x04;
}
if (d[3] == 1) {
c = c + 0x08;
}
if (d[4] == 1) {
c = c + 0x10;
}
if (d[5] == 1) {
c = c + 0x20;
}
if (d[6] == 1) {
c = c + 0x40;
}
if (d[7] == 1) {
c = c + 0x80;
}
printf("%02x", c);
return 0;
}