#include <iostream>
using namespace std;
 
int main(){
        int x,y[25000],z,i;
        while(true){
                i=0;
        cin>>x;
        if(x==-1)break;
                else if(x==0)cout<<0;
        while(x!=0){
                z=x/4;
                y[i]=x%4;
                x=z;
                i++;
        }
                for(int j=i-1;j>=0;j--){
         cout<<y[j];
                }
                
                cout<<endl;
        }
        return 0;
}
 