UVA11918 Traveler of Gridland

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=229&page=show_problem&problem=3069 [PDF](https://uva.onlinejudge.org/external/119/p11918.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11918/5e5a641b9766e4ad2f7c82a6b4700ac8ed3e95bd.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11918/90bdb4ec6a213b8fd69e6e3d1d8d68bcdf38bcee.png)

Output Format

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