#include <iostream>
using namespace std;

void solve(int n){
    if(n == 0){
        cout << "0";
    }else{
        if(n/4){
            solve(n/4);
        }
        cout << n%4;
    }
}

int main(){
    int n;
    int result;

    while(cin >> n, n != -1){
        solve(n);
        cout << endl;
    }
    return 0;
}