#include<iostream>
#include<cmath>
using namespace std;
int a, b[20], ok;
int main() {
	while (true) {
		ok = 0;
		cin >> a;
		if (a == -1) { break; }
		for (int i = 0; i < 15; i++) {
			b[i] = (a / (int)pow(4, i)) % 4;
		}
		for (int i = 14; i >= 0; i--) {
			if (b[i] >= 1) { ok = 1; }
			if (ok == 1 || i == 0) {
				cout << b[i] << endl;
			}
		}
	}
}