#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int n;
  long long m;
  for(;;){
    cin>>n;
    if(n==-1)
      break;
    m=0;
    for(i=10;i>=0;i--){
      m+=n/(long long)pow(4,i)*(long long)pow(10,i);
      n%=(int)pow(4,i);
    }
    cout<<m<<endl;
  }
  return 0;
}
      