#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

long long Decimal4(long long d){
	std::vector<long long> v;
	while(d){
		v.push_back(d%4);
		d /= 4;
	}

	long long j = 1, res = 0;
	for(int i=0;i<v.size();i++){
		res += (j * v[i]);
		j *= 10;
	}

	return res;
}

int main(){
	int i;
	while(std::cin >> i, i >= 0){
		std::cout << Decimal4(i) << '\n';
	}
}