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

int main(){
  int n;
  while(cin >> n && n != -1){
    vector<int> res;
    int b = 4;
    if(n==0) {
      cout << 0 << endl;
      continue;
    }
    while(n > 0){
      res.push_back(n%4);
      n /= 4;
    }
    for(int i = 0; i < (int)res.size(); i++){
      cout << res[res.size() - 1 - i];
    }
    cout << endl;
  }
  return 0;
}