#include<iostream>
#include<vector>

using namespace std;

int main(){

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

    vector<int>V;

    while(1){
      V.push_back(in % 4);
      in /= 4;
      if(in == 0) break;
    }

    for(int i = V.size()-1; i >= 0; i--){
      cout << V[i];
    }

    cout << endl;

  }
  return 0;

}