#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

int main(){
	
	int num;
	
	while(true){
		cin >> num;
		if(num == -1){
			break;
		}
		string str = "D";
		string dum = "D";
		str[0] = '0' + num % 4;
		while(true){
			num /= 4;
			if(num == 0){
				break;
			}
			dum[0] = '0' + num % 4;
			str = dum + str;
		}
		cout << str << endl;
	}
	
	return 0;
}