#include<iostream>
#include<string>
using namespace std;

int main()
{   
    int n;
    string s;

    while( cin >> n )
    {
        if( n == -1 )
            break;
        else if( n == 0 )
            cout << 0 << endl;
        else
        {
            s = "";
            while( n != 0 )
            {
                s += n % 4 + '0';
                n /= 4;
            }
            for( int i = s.size() - 1; i >= 0; i-- )
                cout << s[i];
            
            cout << endl;
        }
    }

    return 0;
}
