#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

bool solve() {
    int n;
    cin >> n;
    if (n == -1) { return false; }
    string rev = "";
    while (n > 0) {
        int rem = n % 4;
        rev += rem + '0';
        n /= 4;
    }
    if (rev == "") rev = "0";
    reverse(begin(rev), end(rev));
    cout << rev << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}