#include<bits/stdc++.h>
using namespace std;
 
int main(){
    long long n;
    long long b[11];
    b[0] = 1;
    for(int i = 1; i <= 10; i++){
    	b[i] = b[i - 1] * 10;
    }
    while(true){
    	cin >> n;
    	if(n == -1)break;
    	long long ans = 0;
    	int i = 0;
    	while(n != 0){
    		ans += (n % 4) * b[i];
    		n /= 4;
    		i++;
    	}
    	cout << ans << endl;
    }
    return 0;
}
