#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int n,table[11],count;
	bool First;

	for(int i=0; i <= 10; i++)table[i] = pow(4,i);

	while(true){
		scanf("%d",&n);
		if(n == -1)break;

		First = true;

		for(int i = 10; i >= 0; i--){
			count = 0;
			while(n >= table[i]){
				n -= table[i];
				count++;
			}
			if(count == 0 && First){
				//Do nothing
			}else{
				printf("%d",count);
				First = false;
			}
		}
		if(First == true)printf("0");
		printf("\n");
	}
    return 0;
}