Boardgame - MarisaOJ: Marisa Online Judge

Boardgame

Time limit: 1000 ms
Memory limit: 256 MB
Marisa just got herself a new board game and she's super excited about it! The game has a cool board represented by an array called $A$, which has a bunch of numbers in it. Her mission is to start at position $u$ and make her way to position $v$. But here's the catch: she can only move in certain ways, and each move has a cost associated with it. Here are her options: - She can move to the position to the left $i-1$, and it'll cost her $L$. - She can move to the position to the right $i+1$, and that'll set her back $R$. - Oh, and there's something really special too! If the numbers at her current position (i) and another position (j) are the same, she can teleport to that position. But this fancy move comes with a cost of $X$. Now Marisa wants to figure out the minimum cost it'll take her to go from position $u$ to position $v$. Can you help her out? ### Input - The first line contains six integers $n,L,R,X,u,v$. - The second line contains $n$ integers $A_i$. ### Output - Print an integer, the minimum cost. ### Constraints - $1 \le n \le 10^5$. - $1 \le L, R, X, A_i \le 10^9$. ### Example Input: ``` 5 1 2 3 1 5 1 2 1 1 2 ``` Output: ``` 5 ```