#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(scanf("%d",&n),n!=-1){
		char change[] = {'0','1','2','3'};
		char ans[100000]={0};
		if(n < 4)ans[0] = n+48;
		else{
			for(int i = 0;; i++){
				ans[i] = change[n%4];
				n /= 4;
				if(n < 4){
					ans[i+1] = n+48;
					break;
				}
			}
		}
		int len = strlen(ans);
		reverse(ans,ans+len);
		printf("%s\n",ans);
	}
	return 0;
}