#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main( void )
{
	int n;
	while ( cin >> n && n != -1 )
	{
		vector <int> numbers;
		int w = n;
		while ( w >= 4 )
		{
			numbers.push_back( w % 4 );
			w /= 4;
		}
		numbers.push_back( w % 4 );

		reverse( numbers.begin(), numbers.end() );
		for ( vector <int>::iterator it = numbers.begin(); it != numbers.end(); it++ )
		{
			cout << *it;
		}
		cout << endl;
	}
	return 0;
}