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

int main()
{
	while (1)
	{
		int s;
		cin >> s;
		if (s == -1)break; int a;
		for (a = 1; a <= s; a*=4) {
		}
		a /= 4;
		for (int b = a; b != 0; b /= 4) {
			cout << s / b;
			s -= s / b*b;
		}
		cout << endl;
	}
}