#include <cstdio>
#include <algorithm>
using namespace std;
int quad[100];

void decToQuad(int n) {
    if (n == 0) { printf("0\n"); return; }
    int idx = 0;
    while (n > 0) {
        quad[idx++] = n%4;
        n /= 4;
    }
    for (int i = idx -1; i >= 0; i--) printf("%d", quad[i]);
    printf("\n");
}


int main()
{
    int n;
    for (; ;) {
        scanf("%d", &n);
        if (n == -1) break;
        decToQuad(n);
    }
    return 0;
}
