#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main(void){
	while(1){
		int n;
		string str;
		scanf("%d",&n);
		if(n==-1)break;
		if(n==0)cout << "0" << endl;
		else{
			while(n>0){
				str+=n%4+'0';
				n=n/4;
			}
			reverse(str.begin(),str.end());
			cout << str << endl;
		}
	}
    return 0;
}