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

using ll = long long;

int main() {
    int n;
    while(cin >> n, n != -1) {
        string res;
        while(n > 0) {
            res += '0' + (n % 4);
            n /= 4;
        }
        reverse(res.begin(), res.end());
        if(res.size() == 0) {
            res += '0';
        }
        cout << res << endl;
    }
}
