#include<iostream>
#include<vector>

int main(){
	int n;
	while (std::cin >> n){

		if (n == -1)break;

		std::vector<int>res;

		do{

			res.push_back(n % 4);

			n /= 4;

		} while (n != 0);

		for (int i = res.size() - 1; i >= 0; i--)std::cout << res[i];
		std::cout << std::endl;
	}
	return 0;
}