#include <iostream>

using namespace std;

int main()
{
	int n;

	while (true)
	{
		cin >> n;

		if (n == -1) { break; }

		if (n == 0)
		{
			cout << "0" << endl;
		}
		else
		{
			int t = (1 << 20);

			for (int i = 0; i < 10; i++)
			{
				t /= 4;

				if (n / t)
				{
					cout << (n / t) % 4;
				}
			}

			cout << endl;
		}
	}

	return 0;
}