#include <iostream>
#include <stack>
using namespace std;

int main() {
	int n; cin >> n; stack<int> st; int temp;
	while (n != -1) {
		if (n == 0) cout << "0" << flush;
		else {
			while (n >= 1) {
				st.push(n % 4); n = n / 4; temp++;
			}
			for (int i = 0; i < temp; i++) {
				cout << st.top() << flush; st.pop();
			}
		}
		cout << endl; cin >> n; temp = 0;
	}
	return 0;
}
