#include <stdlib.h>
#include <stdio.h>

int main(void)
{
	int n;
	char buf[256];
	
	while (1){
		scanf("%d", &n);
		
		if (n == -1) break;
		
		int i = 0;
		do {
			buf[i++] = (n % 4) + '0';
			n /= 4;
		} while (n != 0);
		buf[i] = '\0';
		char out[256];
		for (int j = 0; j < i; j++){
			out[j] = buf[i - j - 1];
		}
		out[i] = '\0';
		
		printf("%s\n", out);
	}
	
	return (0);
}