UVA12827 Just another pachinko-like machine

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=861&page=show_problem&problem=4692 [PDF](https://uva.onlinejudge.org/external/128/p12827.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12827/516f2e60471c86b23ceeee3f691fd17e9f3795e8.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12827/12423648e38698d20dcfd7adc5c4d6ae483fdab0.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12827/630708662173b1b94fc0f36653ac7267773f8d22.png)