#include<stdio.h>
int main()
{
	int n = 0;
	int m = 0; 
	int s = 0;  
	scanf("%x %o", &n, &m); 
	s =  n + m; 
	printf("%d", s );  
	return 0;  
}