16转10方法:0xABC=C16^0+B16^1+A*16^2

let str = readline().substr(2);

const map = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 };
const d = (n) => (n < 10 ? n : map[n]);

let n = 0;
const max = str.length - 1;
for (let i = max; i >= 0; i--) {
  n = n + d(str[i]) * 16 ** (max - i);
}
console.log(n);