UVA573 The Snail

Description

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

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA573/1cd3e0f7896bf4c1e52577552bc05ece438ef237.png)