UVA387 A Puzzling Problem

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=5&page=show_problem&problem=323 [PDF](https://uva.onlinejudge.org/external/3/p387.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA387/2d6ab4158f3f39ebc8cc8e76039f40d5f0c0492c.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA387/5aee13d4aebfee3f4c0fff176766e1335ae8a585.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA387/7d1dffb5a786a10fb5de60d1ddfa405c1796f8b4.png)