UVA11024 Circular Lock

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=22&page=show_problem&problem=1965 [PDF](https://uva.onlinejudge.org/external/110/p11024.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11024/6256eab8b6493afce5e0909d08a3018266993eb1.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11024/88475aecf04e7fbf8a064f77c938c60b711f8bb4.png)

Output Format

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