#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	int n;
	while (scanf("%d", &n), ~n)
	{
		stack<char> d;
		do
		{
			d.push('0' + n % 4);
			n /= 4;
		} while (n);
		for (; !d.empty(); d.pop())
			putchar(d.top());
		putchar('\n');
	}

	return 0;
}