#include <iostream>
#include <cstdio>
using namespace std;
typedef long long int ll;

ll henkan(int n){
	if( n < 4 ){ return n; }
	return henkan(n/4ll) * 10ll + n % 4ll;
}

int main(){
	int n;
	while( cin >> n ){
		if( n == -1 ) break;
		cout << henkan(n) << endl;
	}
}