#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;

	while (cin >> n, n != -1)
	{
		string ans;
		int keta;

		while (true)
		{
			keta = n % 4;
			n /= 4;

			ans = (char)(keta + '0') + ans;

			if (n == 0)
			{
				cout << ans << endl;
				break;
			}
		}
	}
}