#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  while (cin >> n, n != -1) {
    string s;
    while (n) {
      int t = n % 4;
      s = to_string(t) + s;
      n /= 4;
    }
    cout << (s.size() ? s : "0") << "\n";
  }
}
