#include <iostream>

using namespace std;

void dfs(int n) 
{
    if (n != 0) {
        dfs(n / 4);
        cout << n % 4;
    }        
}

int main()
{
    int n;

    while (cin >> n, n != -1) {
        if (n == 0)
            cout << 0;
        else
            dfs(n);
        cout << endl;
    }

    return 0;
}