1891:Trades

时间限制:2 S   /  内存限制:65536 KB
AC:10   /  Submit:27
问题描述

       This is a very easy problem.

      ACMeow loves GTX1920. Now he has m RMB, but no GTX1920s. In the next n days, the unit price of GTX1920 in the ith day is Ci RMB. In other words, in the ith day, he can buy one GTX1920 with Ci RMB, or sell one GTX1920 to gain Ci RMB. He can buy or sell as many times as he wants in one day, but make sure that he has enough money for buying or enough GTX1920 for selling.

      Now he wants to know, how many RMB can he get after the n days. Could you please help him?

      It’s really easy, yeah?

输入描述

First line contains an integer T(1 ≤ T ≤ 20), represents there are T test cases.

For each test case: first line contains two integers n(1 ≤ n ≤ 2000) and m(0 ≤ m ≤ 1000000000). Following n integers in one line, the ith integer represents Ci(1 ≤ Ci ≤ 1000000000). 

输出描述

For each test case, output "Case #X: Y" in a line (without quotes), where X is the case number starting from 1, and Y is the maximum number of RMB he can get mod 1000000007. 

样例输入复制样例

2

3 1

1 2 3

4 1

1 2 1 2

样例输出

Case #1: 3

Case #2: 4

来源
2017年第八届福建省大学生程序设计竞赛正式赛J

Copyright 2016 - 2024 XUJC ACM Team
闽ICP备2020022076号-1