#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define itrep(it, a) for(it = (a).begin(); it != (a).end(); it++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

string solve(int n){
    int k = 1;
    string ans;
    while(k <= n) k*=4;
    k/=4;

    if(k == 0) return "0";
    while(k != 0){
        int a = n / k;
        ans+=a + '0';
        n%=k;
        k/=4;
    }
    return ans;
}

int main(){
    int n;
    while(cin >> n, n != -1){
        cout << solve(n) << endl;
    }
}