#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n != -1)
	{
		if(n == 0)
		{
			cout << 0 << endl;
			continue;
		}
		string binary;
		while(n)
		{
			binary += (char)(n % 2 + '0');
			n /= 2;
		}
		if(binary.size() % 2)
		{
			binary += "0";
		}
		string fourDigits = "";
		for(int i = 0; i < binary.size(); i += 2)
		{
			fourDigits += binary[i] - '0' + 2 * (binary[i + 1] - '0') + '0';
		}
		reverse(fourDigits.begin(), fourDigits.end());
		cout << fourDigits << endl;
	}
}

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