#include <iostream>
using namespace std;

string four(int n){
	string ret;
	while(n){
		ret += (char)(n%4+'0');
		n/=4;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}

int main(){
	int n;
	while(cin >> n && n != -1){
		cout << four(n) << endl;
	}
}