UVA10404 Bachet's Game

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=16&page=show_problem&problem=1345 [PDF](https://uva.onlinejudge.org/external/104/p10404.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10404/b8600a380eb4b5e5bb6a12ee0f2411fb270a26ec.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10404/133fc1417e32c099209748ba2ef7b2695871a068.png)

Output Format

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