#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	while(1){
		cin>>n;
		if(n==-1)break;
		int i=10,ans=n%4;
		n/=4;
		while(n>0){
			ans+=n%4*i;
			i*=10;n/=4;
		}
		cout<<ans<<endl;
	}
}