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

int main(){
	int n;
	string s;

	while( cin >> n , (n != -1) ){
		s.clear();
		do{
			s.push_back( (n%4) + '0' );
			n /= 4;
		}while( n > 0 );
		reverse( s.begin() , s.end() );
		cout << s << endl;
	}
}