import re;R=raw_input;print re.sub("4$","4A",R().encode("hex").upper())if"e"==R()[0]else R().decode("hex")