#include<iostream>
using namespace std;

void four(int n);

int main(){
	int n;
	while(1){
		cin >> n;
		if(n == -1) break;
		four(n);
		cout << endl;
	}
}

void four(int n){
	if(n / 4 == 0){
		cout << n;
	}
	else {
		four(n/4);
		cout << n % 4;
	}
	return;
}