#include <iostream>
#include <math.h>
using namespace std;

int n;

int main() {
	while(cin>>n){
		if(n==-1)return 0;
		int m=n,d=1;
		while(m>3){m/=4;d++;}
		for(int i=d-1;i>=0;i--)cout<<(n/(int)(pow(4,i)+0.1))%4;
		cout<<endl;
	}
}