#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	while(true){
		cin>>n;
		if(n==-1)
			break;
		if(n==0)
			cout<<"0"<<endl;
		else{
		int c=1024*1024;
		bool first=true;
		while(true){
			if(n/c>0){
				first=false;
				cout<<n/c;
				n%=c;
			}
			else if(first==false)
				cout<<"0";
			if(c==1)
				break;
			c/=4;
		}
		cout<<endl;
		}
	}
	return 0;
}