#include<iostream>
#include<string>
using namespace std;
int main() {
	int a[100], b = 0, n, c[100], sum2 = 1;
	long long sum = 1;
	while (sum <= 1000000) {
		a[b] = sum;
		c[b] = sum2;
		b++;
		sum *= 4;
		sum2 *= 10;
	}
	while (cin >> n&&n != -1) {
		char sum3[100];
		bool e = false, f = false;
		sum2 = 0;
		for (int i = b - 1; i >= 0; i--) {
			if (n >= a[i]) {
				e = true;
				f = true;
				int d = (n - (n%a[i])) / a[i];
				sum3[sum2] = (char)d+'0';
				sum2++;
				n -= (a[i] * d);
			}
			if (e&&!f) {
				sum3[sum2] = '0';
				sum2++;
			}
			f = false;
		}
		for (int i = 0; i < sum2; i++) {
			cout << sum3[i];
		}
		cout << endl;
	}
}