#include <iostream>
using namespace std;

int main() {
    while (1) {
        long long int n = 0;
        long long int result = 0;
        
        cin >> n;
        if (n == -1) {
            break;
        }
        
        long long int temp = 0;
        
        for (long long int i = 0; n != 0; i++) {
            temp = n;
            
            n &= 3;
        
            for (long long int j = 0; j < i; j++) {
                n *= 10;
            }
            
            result += n;
        
            n = temp;
            
            n = n >> 2;
        }
        
        cout << result << endl;
    }
    return 0;
}