#include <iostream>
#include <vector>

using namespace std;

void convert(int n, vector<int> *v) {
  if(n == 0) return;
  convert(n / 4, v);
  v->push_back(n % 4);
}

int main() {
  while(1) {
    int n;
    cin >> n;
    if(n == -1) break;

    vector<int> v;
    convert(n, &v);

    for(int i = 0; i < v.size(); i++) {
      cout << v[i];
    }
    cout << endl;
  }
  return 0;
}