#include<iostream>
using namespace std;

int n;

int main(){
	while( cin >> n ){
		if( n == -1 )break;
		
		int ans[30],cor = 0;
		
		if( n == 0 ){
			ans[0] = 0;cor++;
		}
		while( n > 0 ){
			ans[cor] = n%4;
			n/=4;
			cor++;
		}
		for(int i = cor-1;i>=0;i--)
			cout << ans[i];
		cout << endl;
	}
	return 0;
}