UVA617 Nonstop Travel

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=8&page=show_problem&problem=558 [PDF](https://uva.onlinejudge.org/external/6/p617.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA617/1f64fa6719e1475d31c519de75ce28646aa31d4f.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA617/6b4df56f6a4dc539476ba66e754f68aca0b9380e.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA617/135a8047a61953345698af133c5150f1b2701708.png)