#abc310a. A - Order Something Else

A - Order Something Else

Score : 100100 points

问题描述

Takahashi 在一家餐厅想要一杯名为 AtCoderDrink\color{orange} AtCoder Drink 的饮料。这款饮料的正常售价为 PP 日元。

他还有一张折扣券,可以让他以更低的价格 Q 日元购买这款饮料。但是,为了使用这张优惠券,他必须额外点一道该餐厅的 N 道菜中的一道。对于每 i=1,2,...,Ni = 1, 2, ..., N,ii 道菜的价格为 DiD_i 日元。

请输出他要获取这款饮料所需的最低总价。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Takahashi wants a beverage called AtCoder Drink in a restaurant. It can be ordered at a regular price of PP yen.

He also has a discount coupon that allows him to order it at a lower price of QQ yen. However, he must additionally order one of the restaurant's NN dishes to use that coupon. For each i=1,2,,Ni = 1, 2, \ldots, N, the price of the ii-th dish is DiD_i yen.

Print the minimum total amount of money that he must pay to get the drink.

Constraints

  • 1N1001 \leq N \leq 100
  • 1Q<P1051 \leq Q \lt P \leq 10^5
  • 1Di1051 \leq D_i \leq 10^5
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN PP QQ

D1D_1 D2D_2 \ldots DND_N

Output

Print the answer.

Sample Input 1

3 100 50
60 20 40

Sample Output 1

70

If he uses the coupon and orders the second dish, he can get the drink by paying 5050 yen for it and 2020 yen for the dish, for a total of 7070 yen, which is the minimum total payment needed.

Sample Input 2

3 100 50
60000 20000 40000

Sample Output 2

100

The total payment will be minimized by not using the coupon and paying the regular price of 100100 yen.

update @ 2024/3/10 08:47:25