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