#include <iostream>
#include <vector>
using namespace std;
int main(){
	while(true){
		int a;
		vector<int> b;
		cin >> a;
		if(a==-1) break;
		if(a==0){
			cout << 0 << endl;
			continue;
		}
		while(a>0){
			b.push_back(a%4);
			a/=4;
		}
		for(int i=b.size()-1;i>=0;i--){
			cout << b[i];
		}
		cout << endl;
	}
	return 0;
}