#include <iostream>
using namespace std;

int jou(int x,int y){
  int ans = 1,i;

  for(i = 0;i < y;i++){
    if(y != 0) ans *= x;
  }
  if(y == 0) ans = 1;
  return ans;
}


int main(){
  int keta = 0,n;
  int bin[999];

  while(1){
    cin >> n;
    if(n == -1) break;
    int sum = n;
    //keta
    while(1){
      if(n < 4 )break;
      keta++;   
      n /= 4;
    }

    keta ++;
    // cout << "keta = " << keta << endl;

    for(int i = keta - 1;i > 0;i--){
      bin[i] = sum / jou(4,i);
      // cout << "bin[i] = " << bin[i] << "jou(4,1) = " << jou(4,i) << endl;
      sum = sum - jou(4,i) * bin[i];
    }

    bin[0] = sum;

    for(int i = keta - 1;i >= 0 ;i--){
      cout  << bin[i]  ;
    }
    cout << endl;
    keta = 0;
  }
 
}