
#include<iostream>
#include<vector>
using namespace std;

int main()
{
  int n;
  vector<int> v;
  vector<int>::iterator it;
  while (cin>>n, n!=(-1)) {
    v.clear();
    v.push_back(n%4);
    while (n/=4) v.push_back(n%4);
    for (it = v.end(); it != v.begin();)
      cout<<*(--it);
    cout<<endl;
  }
}