#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
using namespace std;
int main(){
    int n;
    while(cin>>n,n!=-1){
        stack<int>S;
        do{
            S.push(n%4);
            n/=4;
        }while(n>0);

        while(S.size()){
            int a=S.top();S.pop();
            cout<<a;
        }
        cout<<endl;
    }
}