#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
	int n,t;
	while(1){
		string a;
		cin >> n;
		if(n==-1){
			return 0;
		}
		if(n==0){
			a += '0';
		}
		for(t=0;n!=0;t++){
			a += '0' + n%4;
			n=n/4;
		}
		reverse(a.begin(), a.end());
		cout << a << endl;

	}
}