#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){

	int n;
	while(cin>>n&&n!=-1){
		string str;
		if(n!=0){
			while(n!=0){
				int t = n % 4;
				str+=(char)(t+'0');
				n/=4;
			}
			reverse(str.begin(),str.end());
			cout<<str<<endl;
		}
		else
			cout<<0<<endl;
	}

	return 0;
}