#include <iostream>
using namespace std;

int main() {
    int a,b;
    scanf("0x%x 0%o",&a,&b);
    printf("%d",a+b);
}
// 64 位输出请用 printf("%lld")