#include <iostream>
#include <vector>

using namespace std;

vector<int> temp;

void Device(int num);
void Output();

int main() {

	int num;

	while (cin >> num && num != -1) {

		if (num == 0)
			cout << "0\n";

		else {
			Device(num);
			Output();

		}
	}
	
	return 0;

}

void Device(int num) {

	temp.clear();
	while (num) {

		temp.push_back(num % 4);
		num /= 4;

	}

}

void Output() {
	for (int i = temp.size() - 1; i >= 0; i--)
		cout << temp[i];
	cout << "\n";
}



