UVA524 素数环 Prime Ring Problem

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=7&page=show_problem&problem=465 [PDF](https://uva.onlinejudge.org/external/5/p524.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA524/5273edd790a23e1ad73d017fd355830ccb468915.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA524/564d6b149cca77cbaf1583cf2a35822a0f78251c.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA524/3944acd7f0b0909cb25a01cbb113e5507c6e3a72.png)