#include<iostream>

using namespace std;

int main(){

	int n;
	int k;

	while(1){
		cin>>n;
		if(n==-1) break;
		for(k=1;k*4<=n;k*=4);
		if(k!=0){
			while(1){
				if(k!=0) cout<<n/k;
				else break;
				n-=(n/k)*k;
				k/=4;
			}
		}
		else cout<<"0";
		cout<<endl;
	}

}