// 0175
#include <iostream>
#include <vector>
using namespace std;

int main(){
	while(1){
		int n;
		cin>>n;

		if(n == -1)
			break;

		vector<int> a;
		if(n == 0)
			a.push_back(0);

		while(n != 0){
			a.push_back(n%4);
			n /= 4;
		}

		for(int i=a.size()-1;i>=0;i--)
			cout<<a[i];
		cout<<endl;
	}
	return 0;
}