#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

long long Quaternary(long long d) {
  vector<long long> v;
  while(d != 0) {
    v.push_back(d % 4); // d % 4 = 3
    d /= 4; // d / 4 = 1
  }
  
  long long j = 1, res = 0;
  for(int i = 0 ; i < v.size() ; i++) {
    res += (j * v[i]);
    j *= 10;
  }
  return res;
}

int main() {
  int decimal;
  while(cin >> decimal, decimal != -1) {
    cout << Quaternary(decimal) << endl; // 10 -> 4
  }
}