#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	
	while(scanf("%d", &n),n != -1){
		char adic[1000];
		int i = 0;
		
		while(n > 0){
			adic[i] = n%4 + '0';
			n /= 4;
			i++;
		}
		
		reverse(adic, adic+i);
		
		printf("%s\n", adic);
	}
	
	return(0);
}