#include<iostream>
using namespace std;
void solve(int);
int main(){
  int n;
  while(cin >> n){
    if(n==-1)break;
    solve(n);
    cout << endl;
  }
}
void solve(int n){
  if(n/4==0){
    cout<<n%4;
    return;
  }
  solve(n/4);
  cout <<n%4;
}