#include<stdio.h>
int a[10000001];
int main(void)
{
	int n;
	int cnt,i;
	
	scanf("%d",&n);
	while(n!=-1){
		cnt=0;
		i=0;
		while(n>=4){
			cnt++;
			a[i]=n%4;
			i++;
			n=n/4;
		}
		printf("%d",n);
		for(i=cnt-1;i>=0;i--){
			printf("%d",a[i]);
		}
		printf("\n");
		scanf("%d",&n);
	}
	return 0;
}