#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == -1)
            return 0;
        if(n == 0){
            cout << 0 << endl;
            continue;
        }

        string ret;
        while(n > 0){
            ret += (n & 3) + '0';
            n >>= 2;
        }
        reverse(ret.begin(), ret.end());
        cout << ret << endl;
    }
}