UVA587 There's treasure everywhere!

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=7&page=show_problem&problem=528 [PDF](https://uva.onlinejudge.org/external/5/p587.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA587/0df0cc30d0cd60fb27ccf04da0387d17f6189567.png)

Input Format

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

Output Format

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