#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

string change(int n){
  int sum = 0;
  string str = ""; 

  while(n > 0){
    str += (n % 4) + '0'; 
    n /= 4;
  }
  reverse(str.begin(),str.end());
  return str;
}

int main(){
  int n;

  while(cin >> n , n != -1){
    if(n == 0){
      cout << 0 << endl;
      continue;
    }
    cout << change(n) << endl;
  }

  return 0;
}