UVA10436 Cheapest way

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=16&page=show_problem&problem=1377 [PDF](https://uva.onlinejudge.org/external/104/p10436.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10436/b4bf154c216377bf147819977d56e947e0593888.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10436/07884bde1697484d0bc2ad5e88d94015fb0b5f3f.png)

Output Format

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