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