#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 1000000000;
using namespace std;

int main() {
  int n, ans[100], i;
  while (cin >> n) {
    if (n == -1)
      break;
    if (n == 0) {
      cout << 0 << endl;
      continue;
    }
    vector<int> v;
    while (n != 0) {
      v.push_back(n % 4);
      n /= 4;
    }
    for (int i = v.size() - 1; i >= 0; i--) {
      cout << v[i];
    }
    cout << endl;
  }
  return 0;
}