#include<iostream>
#include<vector>
using namespace std;

int main(void){
	int num;
	while(cin>>num,num!=-1){
		vector<int> ans;
		while(num>0){
			ans.push_back(num%4);
			num/=4;
		}
		for(int i = ans.size()-1 ;  i >= 0 ; i --){
			cout<<ans[i];
		}
		cout<<endl;
		
	}
}