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

int main() {
  int n;
  while (cin >> n) {
    if (n==-1) {
      break;
    }
    vector<int> ve;
    while (true) {
      ve.push_back(n%4);
      n/=4;
      if (n==0) {
	break;
      }
    }
    for (int i = ve.size()-1; i>=0; i-- ) {
      cout << ve[i] << flush;
    }
	cout << endl;
  }
  return 0;
}