#include <iostream>
#include <list>
using namespace std;
int main()
{
	int n, x, p, l, i, r[11];
	while (cin >> n, (x = n) != -1)
	{
		p = l = 0;
		while (x != 0)
		{
			r[p++] = x % 4;
			x /= 4;
			l++;
		}
		for (i = l-1; i >= 0; i--)
			cout << r[i];
		if (!n) cout << 0;
		cout << endl;
	}
}