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

int main() {

    long int n;

    while(1){

        scanf(" %ld",&n);

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

        string s;

        while(n!=0){

            int a = n%4;

            if(a == 3){
                s = '3' + s;
            }
            else if(a == 2){
                s = '2' + s;
            }
            else if(a == 1){
                s = '1' + s;
            }
            else{
                s = '0' + s;
            }

             n /= 4;

        }

        cout << s << endl;

    }

    return 0;
}