#include <iostream>
using namespace std;

int main() {
    int d,i,f,a;
    while(cin >> d ) {
		if (d==-1) break;
		if (d==0) cout << 0; 
		for (f=0,i=20 ; i>-1 ; i-=2) {
		a=d & ((1<< (i+1))+( 1 << i));
		 if (f==0 && a>0) f=1;
		 if (f==1) cout << (a >> i);
	 }
	 cout << endl;
 } 
	return 0;
}