#include <stdio.h>
int main() {
    int a,b;
    scanf("0x%X 0%o",&a,&b);
    printf("%d",a+b);
    return 0;
}