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


void ten_to_four(int x){
  
  if(x == 0) cout << "0\n";
  vector<int> ans;
  for(int i=0; x!=0 ; i++){
    ans.push_back(x % 4);
    x = (x - (x%4))/4;
  }
  for(int i=ans.size()-1; i>=0 ;i--){
    cout << ans[i] ;
    if(i == 0) cout << "\n";
  }
  
}


int main(){

  while(1){
    int x; cin >> x;
    if(x == -1) break;
    ten_to_four(x);
  }

}