#include<bits/stdc++.h>
using namespace std;
string calc(int n){
  string s;int x=1;
  while(n){
    char c='0'+n%4;s=c+s; n/=4;
  }return s;
}
int main(){
  int n;
  while(cin>>n,n!=-1){
    if(n==0) cout << 0 << endl;
    else cout << calc(n) << endl;
  }
}
