#include<iostream>
using namespace std;
int main(){
  int n,ans[100],i;
  while(cin>>n){
    if(n==-1) break;
    i=0;
    while(n>=4){
      ans[i] = n % 4;
      n /= 4;
      i++;
    }
    ans[i] = n;
    for(int j=i;j>=0;j--) cout << ans[j];
    cout << endl;
  }
  return 0;
}