#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int main() {
	int a;
	int b;
	int c;
	int counter = 0;
	int maecounter = 0;
	while (1) {
		int k = 0;
		cin >> a;
		if (a == -1) {
			break;
		} else {
			while (a >= 4) {
				c = a;
				while (1) {
					b = c / 4;
					if (b == 0) {
						break;
					}
					k = b;
					counter++;
					c = c / 4;
				}
				if (maecounter > counter+1) {
					for (int i = 0; i < maecounter - (counter+1); i++) {
						cout << 0;
					}
				}
				cout << k;
				a = a - pow(4,counter) * k;
				maecounter = counter;
				counter = 0;
			}
			if (maecounter > counter+1) {
				for (int i = 0; i < maecounter - (counter+1); i++) {
					cout << 0;
				}
			}
			cout << a << endl;
		}
	}
	return 0;
}