#include<iostream>
#include<vector>
#define MAX_N 1000000
using namespace std;

int main(){
    int n;
    while(cin >>n){
        if(n == -1) break;
        vector<int> vec;
        int shift = 0;
        for(long int i = 3; i <= MAX_N; i = i << 2){
            int tmp = n & i;
            for(int j = 0; j < shift; j++){
                tmp = tmp >> 2;
            }
            shift++;
            vec.push_back(tmp);
        }
        int stop = vec.size() - 1;
        while(vec[stop] == 0){
            stop--;
            if(stop == 0) break;
        }
        if(stop == 0){
            cout <<"0" <<endl;
        } else{
            for(int i = stop; i >= 0; i--){
                cout <<vec[i];
            }
            cout <<endl;
        }
    }
    return 0;
}