//13
#include<iostream>
#include<string>

using namespace std;

int main(){
  for(int n;cin>>n,n!=-1;){
    string s;
    do{
      s+=char(n%4+'0');
      n/=4;
    }while(n);
    cout<<string(s.rbegin(),s.rend())<<endl;
  }
  return 0;
}