sumcc = 0
BoBo_list = ['A','B','C','D',"E","F"]
BoBo_list.reverse()
for count,i in enumerate(BoBo_list):
    factor = 10+ord(i)-65
    sumcc += pow(16,count)*factor
print("{:15d}".format(sumcc))