#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	int n;
	while(cin >> n)
	{
		vector<int> a;
		if(n == -1)
		{
			break;
		}
		else if(n == 0)
		{
			cout << 0 << endl;
			goto NEXT;
		}
		while(n)
		{
			a.push_back(n % 4);
			n /= 4;
		}
		reverse(a.begin(), a.end());
		for(int i = 0; i < a.size(); ++i)
		{
			cout << a[i];
		}
		cout << endl;
NEXT:
		;
	}
}

int main()
{
	solve();
	return(0);
}