Program / Task Name:

   What's My Score?



 Novice / Advanced

Point Value:




Task Description

A single bowling game consists of ten frames. The object in each frame is to roll a ball at ten bowling pins arranged in an equilateral triangle and to knock down as many pins as possible.

For each frame, a bowler is allowed a maximum of two rolls to knock down all ten pins. If the bowler knocks them all down on the first attempt, the frame is scored as a strike. If the bowler does not knock them down on the first attempt in the frame the bowler is allowed a second attempt to knock down the remaining pins. If the bowler succeeds in knocking the rest of the pins down in the second attempt, the frame is scored as a spare.

The score for a bowling game consists of sum of the scores for each frame. The score for each frame is the total number of pins knocked down in the frame, plus bonuses for strikes and spares. In particular, if a bowler scores a strike in a particular frame, the score for that frame is ten plus the sum of the next two rolls. If a bowler scores a spare in a particular frame, the score for that frame is ten plus the score of the next roll. If a bowler scores a strike in the tenth (final) frame, the bowler is allowed two more rolls. Similarly, a bowler scoring a spare in the tenth frame is allowed one more roll.

The maximum possible score in a game of bowling (strikes in all ten frames plus two extra strikes for the tenth frame strike) is 300.

Program Input

The input file ( consists of a sequence of bowling game scores. Each line will contain the scores for a single game. The score for a single roll will be represented by a single character -- either a number indicating the number of pins knocked down, a '/' for a spare or a capital 'X' for a strike:


Program Output

Output the actual score sheet for each game, complete with pin count and cumulative score for each frame as follows:

 Game       1    2    3    4    5    6    7    8    9     10
|       | 9|/|  |X| 9|/|  |X| 9|/|  |X| 9|/|  |X| 9|/| 9|/|9|
|       |----|----|----|----|----|----|----|----|----|------|
|Game 1 |  20|  40|  60|  80| 100| 120| 140| 160| 179|   198|
|       |  |X|  |X|  |X|  |X|  |X|  |X|  |X|  |X|  |X| X|X|X|
|       |----|----|----|----|----|----|----|----|----|------|
|Game 2 |  30|  60|  90| 120| 150| 180| 210| 240| 270|   300|
|       | 9|0| 9|0| 9|0| 9|0| 9|0| 9|0| 9|0| 9|0| 9|0| 9|0| |
|       |----|----|----|----|----|----|----|----|----|------|
|Game 3 |   9|  18|  27|  36|  45|  54|  63|  72|  81|    90|



  (c) 2004 Hewlett-Packard Company