const line = readline() const option = { "A": 10, "B": 11, "C": 12, "D": 13, "E": 14, "F": 15, } const target = line.slice(2).split("").reverse() const itemList = target.reduce( (total, item, index ) => { const current = (option[item] || item) * ( 16 ** index ) return total + current }, 0) print( itemList )