#include<iostream>
#include<bitset>
#include<string>
using namespace std;
int main() {
    int n, a,j=0;
    bool bo = false;
    int ans[102] = { 0 },ans1=0;
    bitset <101> bset;
    while (1) {
		cin >> n;
		if(n==-1){
			break;
		}
        bset = n;
        for (int i = bset.size() - 1; i >= 0; i--) {
            if (i % 2 == 0) {
                if (1 & bset[i] == 1) {
                    ans[j] += 1;
                }
                if (i != 0) {
                    j++;
                }
            }
            else {
                if (1 & bset[i] == 1) {
                    ans[j] += 2;
                }
            }
        }
        for (int i = 0; i <= j; i++) {
            if (ans[i] != 0) {
                bo = true;
            }
            if (bo) {
                cout << ans[i];
            }
        }
		if(bo==false){
			cout<<0;
		}
		cout << endl;
        bo = false;
        for (int i = 0; i < 102; i++) {
            ans[i] = 0;
        }
        j = 0;
        bset = 0;
    }
    return 0;
}