#include <iostream>

using namespace std;

void saiki( int n ){
	int a = n % 4;
	if( n == 0 ) return;
	saiki( n / 4 );
	cout << a;
}

int main(int argc, char const* argv[])
{
	int n;

	while( cin >> n && n != -1 ){
		if( n == 0 ) cout << 0;
		else saiki( n );
		cout << endl;
	}
	return 0;
}