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

int a[10], hd;
int main(void){
	int n;
	for(;;){
		scanf("%d", &n);
		if(n == -1)break;
		hd = 0;
		for(;n;n/=4)a[hd++] = n % 4;
		if(hd == 0)puts("0");
		else{
			for(;hd--;)printf("%d", a[hd]);
			puts("");
		}
	}
}