UVA10067 Playing with Wheels

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=12&page=show_problem&problem=1008 [PDF](https://uva.onlinejudge.org/external/100/p10067.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10067/3395fd63f9be5f14cb8cd9482c509f0911e43819.png)

Input Format

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

Output Format

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