#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main() {
  int n;
  while(cin >> n && n!=-1) {
    int k=262144;
    string s="";
    while(1) {
      char a='0';
      if(n>=k) {
	a=(char)(n/k+48);
      }
      s+=a;
      if(k==1) break;
      n%=k;
      k/=4;
    }
    stringstream ss;
    ss << s;
    long long m;
    ss >> m;
    stringstream ss2;
    ss2 << m;
    ss2 >> s;
    cout << s << endl;
  }
  return 0;
}
