#include<iostream>
#include<stack>
using namespace std;

int main() {
	int n;
	while (cin >> n&&n != -1) {
		stack<int>s;
		while (n >= 4) {
			s.push(n % 4);
			n /= 4;
		}
		s.push(n);
		int a = s.size();
		for (int i = 0;i < a;i++) {
			cout << s.top();
			s.pop();
		}
		cout << endl;
	}
	return 0;
}