#include<iostream>
using namespace std;
int main() {
	int z[2002], x, kai, m, bai,i;
	kai = 0;
	while (1) {
		cin >> x;
		if (x == -1) {
			goto a;
		}
		kai = kai + 1;
		bai = 1;
		z[kai] = 0;
		while (1) {
			m = x % 4;
			x = (x - m)/4;
			if (bai == 1) {
				z[kai] = m;
			}else {
				z[kai] = z[kai] + m * bai;
			}
			bai = bai * 10;
		}
	}
a:;
	for (i = 1; i <= kai; i++) {
		cout << z[i] << endl;
	}
}
