#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
 
  while( cin >> n ){
    if(n == -1)break;
    vector<int>ve;
    while(1){
      ve.push_back(n%4);
      n/=4;
      if(n == 0)break;
    }
    for(int i = ve.size()-1 ; i >= 0 ; i-- )cout << ve[i];
    cout << endl;
  } 
}