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