#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

string text;
string hold;
int num;
int main() {
    ifstream in;
    in.open ("DATA3.txt");
    ofstream out;
    out.open ("OUT3.txt");
    for (int i = 0; i<5; i++) {
    	hold = "";
    	text = "";
    	getline(in, text);
    	out << text << endl;
    	hold = text.substr();
    	int len = text.size();
    	vector<pair<int, int> > players;
    	for (int j = 0; j<len; j++) {
    		if (isdigit(hold[j])) players.push_back(make_pair(j, (int)hold[j]-48));// cout << ((int)hold[j]-48);}
    	}
    	for (int j = 0; j<4; j++) {
    		for (int k = players.size()-1; k>=0; k--) {
    			//cout << k;
    			if (players[k].first == -1) continue;
    			int x = (int)hold[players[k].first] - 48;
    			x-=players[k].second;
    			//cout << x;
    			if (x==0) {
    				for (int h = players.size()-1; h>=0; h--) {
    					if (players[h].first==players[k].first && players[h].second == 0) {
    						hold[players[k].first] = '0';
    						break;
    					}
    					else hold[players[k].first] = '.';
    				}
    			}
    			else hold[players[k].first] = (char)(((int)hold[players[k].first] - 48) - players[k].second + 48);
    			//hold[players[k].first] = '.';
    			players[k].first += players[k].second;
    			if (players[k].first>=len) {
    				players[k].first = -1;
    				continue;
    			}
    			if (!isdigit(hold[players[k].first])) hold[players[k].first] = (char)(players[k].second+48);
    			else hold[players[k].first] = (char)(((int)hold[players[k].first] - 48) + players[k].second + 48);//*/
    		}
    		out << hold << endl;
    	}
    	//cout << hold << endl;
    }
    in.close();
    out.close();
    return 0;
}

