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

int main(){
	int n;
	while(scanf("%d",&n), n != -1){
		if(n == 0){
			printf("0\n");
			continue;
		}
		stack<int> st = stack<int>();
		while(n != 0){
			int r = n % 4;
			n /= 4;
			st.push(r);
		}
		while(!st.empty()){
			printf("%d",st.top());
			st.pop();
		}
		printf("\n");
	}
	return 0;
}

