#C8626. Minimum Fuel Cost

    ID: 52629 Type: Default 1000ms 256MiB

Minimum Fuel Cost

Minimum Fuel Cost

You are given fuel station data and a fuel tank capacity. For each test case, you need to determine the minimum cost required to completely fill the fuel tank. Each test case contains an integer N representing the number of fuel stations, followed by N space-separated integers representing the fuel prices at each station, and finally an integer M representing the fuel tank capacity in liters.

You must use the station with the smallest fuel price to fill the tank. The cost is calculated using the formula: \( cost = p \times M \), where \( p \) is the minimum price among the given stations.

inputFormat

The input is read from stdin and has the following format:

  • The first line contains an integer T indicating the number of test cases.
  • For each test case:
    • The first line contains an integer N, the number of fuel stations.
    • The second line contains N space-separated integers, representing the fuel prices at each station.
    • The third line contains an integer M, the capacity of the fuel tank (in liters).

outputFormat

For each test case, output the minimum cost to fill the fuel tank completely on a new line. The output is written to stdout.

## sample
2
5
10 20 15 25 30
50
3
7 14 5
20
500

100

</p>