#include<iostream>
using namespace std;
int box[]={0,1,2,3};
void oct(int x){
	int a=x%4;
	if(x/4!=0)
	oct(x/4);
	cout<<box[a];
}
int main(){
	int x;
	while(cin>>x,x!=-1){
		oct(x);
		cout<<endl;
	}
	return 0;
}