#include <bits/stdc++.h>
using namespace std;

int main() {

    long int n;

    while(1){

        scanf(" %ld",&n);

        if(n==-1){
            break;
        }

        vector<int> v;

        while(n!=0){

            int a = n%4;

            if(a == 3){
                v.push_back(3);
            }
            else if(a == 2){
                v.push_back(2);
            }
            else if(a == 1){
                v.push_back(1);
            }
            else{
                v.push_back(0);
            }

             n /= 4;

        }

        reverse(v.begin(),v.end());

        for(int i=0;i<v.size();i++){
            cout << v[i];
        }

        cout << endl;

    }

    return 0;
}