#include<iostream>
#include<string>
using namespace std;
char f(int k) {
	if (k == 1)return '1';
	if (k == 2)return '2';
	if (k == 3)return '3';
	return '0';
}
int main() {
	int n;
	while (cin >> n) {
		if (n == -1)return 0;
		if (n == 0)cout << "0\n";
		else {
			string ans;
			while (n != 0) {
				ans = f(n % 4) + ans;
				n = (n - n % 4) / 4;
			}
			cout << ans << endl;
		}
	}
}