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