#include <iostream>
using namespace std;

int main(){
	int n;
	while(cin >> n && n != -1 ){
		if( n == 0 ) cout << 0 << endl;
		else{
			string s;
			while(n){
				s += n % 4 + '0';
				n /= 4;
			}
			for(int i = s.size()-1 ; i >= 0 ; i--)
				cout << s[i];
			cout << endl; 
		}
	}
}