#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

string convert(int n) {
    string s;
    while (n >= 4) {
        int p = n % 4;
        s.push_back(p+'0');
        n /= 4;
    }
    s.push_back(n+'0');
    reverse(s.begin(), s.end());
    return s;
}

int main() {
    int n;
    while (cin >> n) {
        if (n == -1) break;
        cout << convert(n) << endl;
    }
    return 0;
}