#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int n;
	while (cin >> n, n != -1) {
		vector<int>v;
		do {
			v.push_back(n % 4);
			n /= 4;
		} while (n != 0);
		for (int i = v.size() - 1; i >= 0;i--) {
			cout << v[i];
		}
		cout << endl;
	}
	return 0;
}