atcoder#ABC263D. [ABC263D] Left Right Operation

[ABC263D] Left Right Operation

Score : 400400 points

Problem Statement

You are given an integer sequence of length NN: A=(A1,A2,,AN)A=(A_1,A_2,\ldots,A_N).

You will perform the following consecutive operations just once:

  • Choose an integer xx (0xN)(0\leq x \leq N). If xx is 00, do nothing. If xx is 11 or greater, replace each of A1,A2,,AxA_1,A_2,\ldots,A_x with LL.
  • Choose an integer yy (0yN)(0\leq y \leq N). If yy is 00, do nothing. If yy is 11 or greater, replace each of AN,AN1,,ANy+1A_{N},A_{N-1},\ldots,A_{N-y+1} with RR.

Print the minimum possible sum of the elements of AA after the operations.

Constraints

  • 1N2×1051 \leq N \leq 2\times 10^5
  • 109L,R109-10^9 \leq L, R\leq 10^9
  • 109Ai109-10^9 \leq A_i\leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN LL RR

A1A_1 A2A_2 \ldots ANA_N

Output

Print the answer.

5 4 3
5 5 0 6 3
14

If you choose x=2x=2 and y=2y=2, you will get A=(4,4,0,3,3)A = (4,4,0,3,3), for the sum of 1414, which is the minimum sum achievable.

4 10 10
1 2 3 4
10

If you choose x=0x=0 and y=0y=0, you will get A=(1,2,3,4)A = (1,2,3,4), for the sum of 1010, which is the minimum sum achievable.

10 -5 -3
9 -6 10 -1 2 10 -1 7 -15 5
-58

LL, RR, and AiA_i may be negative.