#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

int main() {
	int n;
	while (cin >> n, n != -1) {
		string ans = "";
		while (n > 0) {
			ans.push_back(n % 4 + '0');
			n = n / 4;
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
	}
	return 0;
}