#include <stdio.h>

int main(void){
    int n,q, dig;
    
    while (scanf("%d", &n), n!=-1){
        dig = 0;
        q=0;
        while (n){
            q += n%4;
            q *= 10;
            n /= 4;
            dig++;
        }
        q /= 10;
        if (dig){
            while (dig--){
                printf("%d", q%10);
                q /= 10;
            }
        } else printf("0");
        printf("\n");
    }
    
    return 0;
}