#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAX 20

void Input(int a[])
{
	int i, j;
	char str[MAX] = {0};
	
	scanf("%s", str);
	j = strlen(str);a[0] = j / 4 + 1;
	for (i = 1, --j; j >= 0; ++i)
	{
		a[i] = str[j--] - '0';
		if(j < 0)	break;
		a[i] += (str[j--] - '0') * 10;
		if(j < 0)	break;
		a[i] += (str[j--] - '0') * 100;
		if(j < 0)	break;
		a[i] += (str[j--] - '0') * 1000;
	}
}

int Divide(int a[], int n)
{
	int temp = 0;
	for (int i = a[0]; i >= 1; --i)
	{
		temp = a[i] % n;
		a[i] /= n;
		if(i > 1)
		a[i-1] += temp * 10000;
	}
	if (0 == a[1] && 1 == a[0])
	{a[0]=0;return temp;}
	while ( !a[ a[0] ] )	--a[0];
	return temp;
}

char Get(int n, int base)
{
	if (n < 0 || n > base)
	{
		puts("Data Error!");
		exit(0);
	}
	return n < 10 ? n + '0' : n + 'A' - 10;
}

void my_itoa(int a[], char *str, int base)
{
	for (int i = 0; a[0];)
		str[i++] = Get(Divide(a, base), base);
	str[i] = '\0';
	strrev(str);
}

int main()
{
	int a[MAX/4+3] = {0};
	char str[MAX] = {0};

	Input(a);
	my_itoa(a, str, 16);
	puts(str);

	return 0;
}