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

string base4(int p) {

  string s;
  while(true) {
    if(!p) break;
    s = string( 1, '0'+p%4 ) + s;
    p /= 4;
  }
  if( s == "" ) s = "0";
  return s;
}

int main() {
  int n;
  while(true) {

    cin>>n;
    if( n == -1 ) break;

    cout<<base4(n)<<endl;

  }
}