#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;

int main(){
    int n;
    while(cin>>n&&n!=-1){
        long i=0,ans=0;
        while(n){
            ans+=(n%4)*pow(10,i);
            n/=4;
            i++;
        }
        cout<<ans<<endl;
    }
    return 0;
}
