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

int main()
{
	int n;

	cin >> n;

	while (n != -1) {
		string s;

		if (n == 0)
			s = "0";

		while (n > 0) {
			s = to_string(n % 4) + s;
			n /= 4;
		}

		cout << s << endl;
		
		cin >> n;
	}

	return 0;
}

