#include <bits/stdc++.h>

using namespace std;

int main()
{
  int n;
  while(cin >> n, n != -1){
    vector<int> four;
    four.push_back(n % 4);
    n /= 4;
    while(n > 0){
      four.push_back(n % 4);
      n /= 4;
    }
    reverse(four.begin(), four.end());
    for(int i = 0; i < four.size(); i++) cout << four[i];
    cout << endl;
  }
  return 0;
}
 