#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	int temp;
	int a[1000];
	int cnt = 0;
	while (cin >> n){
		if (n == -1) break;
		while (n > 0){
			temp = n % 4;
			a[cnt] = temp;
			n /= 4;
			cnt++;
		}
		if (cnt == 0) cout << "0" << endl;
		for (int i = cnt - 1; i >= 0; i--) {
			cout << a[i];
			if (i == 0) cout << endl;
		}
		cnt = 0;
	}
	return 0;
}