#include <iostream>
#include <stack>
using namespace std;
int main(){
	stack<int> a;
	int n;
	while(cin>>n && n!=-1){
		while(n){
			a.push(n%4);
			n/=4;
		}
		while(a.empty() != true){
			cout<<a.top();
			a.pop();
		}
		cout<<endl;
	}
	return 0;
}