#include<iostream>
#include<vector>
using namespace std;
int main(void){
    int n;
    while(1){
        vector<int> c;
        cin>>n;
        if(n==-1)break;
        if(n==0)
        cout<<0;
        while(n>0){
        c.push_back(n%4);
        n/=4;
        }
        for(int i=c.size()-1;i>=0;i--)
        cout<<c[i];
        cout<<endl;

    }
    return 0;
}