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

int main(){
	string s;
	int n;
	while (1) {
		s = "";
		cin >> n;
		if (n == -1) break;
		for (int i = 0; n;i++) {
			char c = '0' + (n % 4);
			s = c + s;
			n /= 4;
		}
		if (s.empty()) s = "0";
		cout << s << endl;
	}
	return 0;
}