#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    int n;
    while(cin >> n)
    {
        if(n == -1 ) break;

        vector<int> ans;
        if(n == 0) ans.push_back(0);
        
        while(n)
        {
            ans.push_back(n % 4);
            n /= 4;
        }
        

        int l = ans.size();
        REP(l) cout << ans[l - i - 1] ;
        cout<< endl;

    }
    return 0;
}