UVA667 Fence

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=8&page=show_problem&problem=608 [PDF](https://uva.onlinejudge.org/external/6/p667.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA667/3720e45d31aad3e9295c2f7d050fbb54b4e7b829.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA667/52834c79b7bcbfef1d47a8e26213b07b21c18f0a.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA667/463ad13dc27d5a9212325200db193ccdc993fb52.png)