// 2011/01/31 Tazoe

#include <iostream>
using namespace std;

void print4(int n)
{
	if(n/4!=0)
		print4(n/4);

	cout << n%4;
}

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==-1)
			break;

		print4(n);
		cout << endl;
	}

	return 0;
}