UVA10967 The Great Escape

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=21&page=show_problem&problem=1908 [PDF](https://uva.onlinejudge.org/external/109/p10967.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10967/fa647aeb470fb3398964117672da7223f4b11adb.png)

Input Format

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

Output Format

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