#include <iostream>
#include <cmath>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main(){
	int n;
	while(cin >> n) {
		if(n == -1) break;
		int N = 0;
		while((int)pow(4,N) <= n) N++;
		N--;
		while(N > 0) {
			cout << n / (int)pow(4,N);
			n -= (n / (int)pow(4,N)) * (int)pow(4,N);
			N--;
		}
		cout << n << endl;
	}
	return 0;
}