#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int n;
  while(cin>>n){
    if(n==-1) break;
    if(n==0){
      printf("0\n");
      continue;
    }
    stack<int> stk;
    while(n!=0){
      stk.push(n%4);
      n/=4;
    }
    while(!stk.empty()){
      printf("%d",stk.top());
      stk.pop();
    }
    printf("\n");
  }
  return 0;
}