UVA12766 Grinding Grid

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=823&page=show_problem&problem=4619 [PDF](https://uva.onlinejudge.org/external/127/p12766.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12766/06a6e7c9d541414e898dbfc0958a735bca54e3b7.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12766/2045fed2dc23874d792928586cc60308d5df0ceb.png)