#include <iostream>
#include <string>
using namespace std;
int main() {
string hex;
cin >> hex;
// 去掉"0x"前缀
hex = hex.substr(2);
// 将十六进制转换为十进制
int decimal = 0;
for(char c : hex) {
decimal *= 16;
if(c >= '0' && c <= '9') {
decimal += c - '0';
} else {
decimal += (toupper(c) - 'A' + 10);
}
}
cout << decimal << endl;
return 0;
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String hex = sc.nextLine();
// 方法1:使用Integer内置方法
System.out.println(Integer.parseInt(hex.substring(2), 16));
/* 方法2:手动实现
hex = hex.substring(2); // 去掉0x
int decimal = 0;
for(char c : hex.toCharArray()) {
decimal = decimal * 16 +
(Character.isDigit(c) ? c - '0' : Character.toUpperCase(c) - 'A' + 10);
}
System.out.println(decimal);
*/
}
}
# 读取输入,去掉0x前缀
hex_str = input().strip()[2:]
# 方法1:使用int内置函数
print(int(hex_str, 16))
'''
# 方法2:手动实现
decimal = 0
for c in hex_str:
decimal *= 16
if c.isdigit():
decimal += int(c)
else:
decimal += ord(c.upper()) - ord('A') + 10
print(decimal)
'''