#!/usr/bin/env python3
# @author 轩辕龙儿
# @date 2022/10/25
# @file NP9.py
def solution():
num16 = input()
num10 = int(num16, 16)
print(num10)
if __name__ == "__main__":
solution()