#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)

void convert(int x) {
	if (x == 0) {
		cout << 0 << endl;
		return;
	}
	
	int mul = 16777216;
	bool flag = false;
	
	for_rev(i,12,0) {
		if (flag || x / mul > 0) {
			cout << x / mul;
			x -= (x / mul) * mul;
			flag = true;
		}
				
		mul /= 4;
	}
	
	cout << endl;
}

int main() {
	int n;
	while (cin >> n, n != -1) convert(n);
}