#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define INF 999999
using namespace std;
int main(){
    int N,hoge[10000]={0},i;
    while(cin>>N){
        if(N==-1)break;
        for(i=0;i<10000;i++){
            if(N<4){
                hoge[i]=N;
                break;
            }
            hoge[i]=N%4;
            N/=4;
        }
        for(int j=i;j>=0;j--){
            cout<<hoge[j];
        }
        puts("");

    }
    return 0;
}