#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF = 10000000;
using namespace std;
/** Problem0175 : A King in Hawaii **/
int main()
{
	int n;
	while (cin>>n, n!=-1) {
		string ans;
		while (1) {
			ans+=(n%4)+'0';
			n/=4;
			if (n == 0) break;
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
	}
	return 0;
}