#include<iostream>
using namespace std;
#include<algorithm>
#define REP(i,a) for(int  i=0;i<a;i++)
int main(){


	int a,b=0,c,A[100000],n,j,k;	
	cin>>n;
	while(n!=-1){
	a=n;
		while(1){
			if(a<4) {
				A[b]=a;
				break;
			}
			A[b]=a/4;
			a=a%4; 
			b++;
		}
		REP(i,b+1){
			cout<<A[i];

		}
		cout<<endl;
		b=0;
		cin>>n;
	}
	return 0;
}