#include <iostream>
using namespace std;

int main() {
  int n;
  while(cin >> n) {
    if(n == -1) break;
    int mod = 4*4*4*4*4*4*4*4*4;
    bool r = false;
    for(int i=0;i<10;i++) {
      if( n/mod != 0 || i==9) {
        r = true;
      }
      if(r) {
        cout << n/mod;
      }
      n -= (n/mod) * mod;
      mod/=4;
    }
    cout << endl;
  }
}