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

int main(){

  int n;

  while(1){

    cin >> n;
    if(n < 0) break;

    string s;

    while(1){
      s += (n%4 + 48);

      n /= 4;
      if(n == 0) break;
    }

    for(int i=s.size()-1;i >= 0;i--) cout << s[i];
    cout << endl;
  }
}