#include <iostream>
#include <cstring>
using namespace std;

int main(){
    char num[100];
    int s,value;
    while(cin >> s && s != -1){
        value = 0;
        if(s == 0){
            cout << "0" << endl;
            continue;
        }
        memset(num,0,sizeof(num));
        while(s !=  0){
            num[value] = (s%4)+'0';
            s /= 4;
            value++;
        }
        for(int i=value-1;i>=0;i--){
            (i == 0)? cout << num[i] << endl : cout << num[i];
        }
    }
}