#include <bits/stdc++.h>

using namespace std;

int main(void) {
  int n;
  while (cin >> n, n != -1) {
    if (!n) {
      cout << "0\n";
      continue;
    }
    
    string ans = "";
    while (n) {
      ans = (char)((n % 4) + '0') + ans;
      n /= 4;
    }
    cout << ans << endl;
  }

  return 0;
}
