UVA12877 GREAT + SWERC = PORTO

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=861&page=show_problem&problem=4742 [PDF](https://uva.onlinejudge.org/external/128/p12877.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12877/9da959c0f11f8756be1cd6a763f29b9089c5de71.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12877/8cbe2630ced7c54fda9e62867838aba48828faf0.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12877/649974b4428f96e0fc47c79a8372b54db7901c44.png)