#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

VI p4 = { 1,4,16,64,256,1024,4096,16384,65536,262144,1048576, };

string solve(int n) {
	string ret;

	bool flag = false;
	for (int i = 9; i >= 0; i--) {
		int p = n / p4[i];
		n %= p4[i];
		if (p != 0 || i == 0)flag = true;

		//cout << p4[i] << " : " << p << endl;

		if (flag)ret += '0' + p;
	}

	return ret;
}


int main() {
	while (true) {
		int a; cin >> a;
		if (a == -1)break;
		Cout(solve(a));
	}
}
