UVA13180 The countess’ pearls

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=871&page=show_problem&problem=5091 [PDF](https://uva.onlinejudge.org/external/131/p13180.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA13180/e176180f09f37cb1052ca576a6fc62827dbbb625.png)

Input Format

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

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA13180/12662de0f08d92f429b74eee50fd8d006ae110a3.png)