#include<iostream>
#include<algorithm>
#include<string>
#include<stack>
#include<cstdio>
#include<map>
#include<functional>
#include <sstream>

using namespace std;

string ans;

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}


string sinsuu(int n){
    ans += IntToString(n%4);
    if (n==0)
    {
        ans="0";
        return ans;
    }
    if( (n/4) < 4 )
    {
        ans += IntToString(n/4);
        reverse( ans.begin(), ans.end());
        return ans;
    }
    else
    {
        n = n/4;
        return sinsuu(n);
    }
}

int main(){
	int n;
    while (1)
    {
        cin>>n;
        if(n<0)break;
        cout<<sinsuu(n)<<endl;
        ans.clear();
        
    }
	return 0;
}