#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
using namespace std;

const int INF = 1e9;
typedef long long ll;

int main(void){
  int n;
  while(cin >> n && n != -1){
    string quaternary("");
    while(n != 0){
      quaternary.insert(quaternary.begin(), 1, (n % 4) + '0');
      n /= 4;
    }
    if(quaternary == "") quaternary = "0";
    cout << quaternary << endl;
  }
  return 0;
}