#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n;
	vector<int> result;
	
	while (cin >> n, n != -1){
		while (1){
			result.push_back(n % 4);
			n /= 4;
			if (n == 0){
				break;
			}
		}
		for (int i = result.size() - 1; i >= 0; i--){
			cout << result[i];
		}
		cout << endl;
		result.clear();
	}
	return (0);
}