#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	while(cin>>n&&n!=-1){
		string ans;
		for(;n>0;n/=4)ans+=n%4+'0';
		if(ans.size()==0)cout<<0;
		else for(int i=ans.size()-1;i>=0;i--)cout<<ans[i];
		cout<<endl;
	}
}