#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(cin >> n){
		if(n==-1) break;
		vector<int> ans;
		while(n >= 4){
			ans.push_back(n%4);
			n/=4;
		}
		ans.push_back(n);
		vector<int>::reverse_iterator it=ans.rbegin();
		while(it != ans.rend()){
			cout << *it;
			it++;
		}
		cout << endl;
	}
	return 0;
}