UVA894 Juggling Trams

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=10&page=show_problem&problem=835 [PDF](https://uva.onlinejudge.org/external/8/p894.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA894/2ddf7d71fa0c34fc80b3e2a28ded66592c74ea22.png)

Input Format

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

Output Format

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