UVA12829 Just another pachinko-like machine (II)

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=861&page=show_problem&problem=4694 [PDF](https://uva.onlinejudge.org/external/128/p12829.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12829/3b22159d4d33b8752814aa690a40730f06f7614d.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12829/f39b250b1d90a9c48a8d5c9e75d7262eb1262f97.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12829/243ee48e6089fce020af62ae1571cf46c59ee178.png)