#include <stdio.h>    
#include <math.h>

int main()
{
	int a, b;
	int flag=0;
	int i, j;

	int m4 = (int)pow(4.0, 13);
	int c = m4;
	while (scanf("%d", &a), a != -1){
		flag = 0;
		if (a == 0) printf("0");
		else{
			c = m4;
			for (i = 0; c != 0; c /= 4){
				b = a / c;
				a %= c;
				if (b != 0){ printf("%d", b); flag = 1; }
				else{
					if (flag != 0)printf("0");
				}
			}
		}
		printf("\n");
	}
	return 0;
}