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

int main()
{
	int n;
	vector<int> change;

	while (cin >> n, n != -1){
		while (1){
			change.push_back(n % 4);
			if (n / 4 == 0){
				break;
			}
			n /= 4;
		}
		reverse(change.begin(), change.end());

		for (int i = 0; i < change.size(); i++){
			cout << change[i];
		}
		cout << endl;

		change.clear();
	}

	return (0);
}