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