#include <iostream>
#include <string>

using namespace std;

int n = 0;

bool input(){
  	cin >> n;
    if (n == -1) {
  	    return (false);
 	}
 	return (true);
}

string ans(){
    string res = "";
  	while (n != 0){
        res = char('0' + n % 4) + res;
        n /= 4;
    }
    if (res.size() == 0){
		res = "0";
    }
    
	return (res);
}

int main(){
    while(input()){
        string a = ans();
        cout << a << endl;
    }
	
	return (0);
}