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

int main()
{
	int n;
	while( cin >> n && n != -1 ){
		int exp = 1;
		string d;
		while( n > 0 ){
			int m = n % ( 1 << ( 2 * exp ) );
			m /= ( 1 << ( 2 * ( exp - 1 ) ) );
			d.insert( d.begin(), ( m + '0') );
			n -= ( m * ( 1 << ( 2 * ( exp - 1 ) ) ) );
			++exp;
		}
		if( d.empty() ){
			d = '0';
		}
		cout << d << endl;
	}

	return 0;
}