#include <iostream>
#include <stack>
using namespace std;

int main()
{

	int n;
	stack< int > out;

	while( true ) {

		cin >> n;
		if( n == -1 ) break;
		do {
			
			out.push( n % 4 ); n /= 4;

		} while( n );

		while( !out.empty() ) { cout << out.top(); out.pop(); }

		cout << endl;

	}

	return 0;

}