有趣的赛车比赛 Funny Car Racing

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=602&page=show_problem&problem=4399 [PDF](https://uva.onlinejudge.org/external/126/p12661.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12661/1690bfbdd2c4e6a32cb086bc647f66c42cb92640.png)

输入输出格式

输入格式


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

输出格式


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

输入输出样例

输入样例 #1

3 2 1 3
1 2 5 6 3
2 3 7 7 6
3 2 1 3
1 2 5 6 3
2 3 9 5 6

输出样例 #1

Case 1: 20
Case 2: 9