#include <iostream>
#include <cmath>
using namespace std;

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == -1) {
            break;
        }
        long long output = 0;
        for (int i = 0; n > 0; i++) {
            output += (n % 4) * pow(10, i);
            n /= 4;
        }
        cout << output << endl;
    }
}