Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Array GCD

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given array *a*_{i} of length *n*. You may consecutively apply two operations to this array:

- remove some subsegment (continuous subsequence) of length
*m*<*n*and pay for it*m*·*a*coins; - change some elements of the array by at most 1, and pay
*b*coins for each change.

Please note that each of operations may be applied at most once (and may be not applied at all) so you can remove only one segment and each number may be changed (increased or decreased) by at most 1. Also note, that you are not allowed to delete the whole array.

Your goal is to calculate the minimum number of coins that you need to spend in order to make the greatest common divisor of the elements of the resulting array be greater than 1.

Input

The first line of the input contains integers *n*, *a* and *b* (1 ≤ *n* ≤ 1 000 000, 0 ≤ *a*, *b* ≤ 10^{9}) — the length of the array, the cost of removing a single element in the first operation and the cost of changing an element, respectively.

The second line contains *n* integers *a*_{i} (2 ≤ *a*_{i} ≤ 10^{9}) — elements of the array.

Output

Print a single number — the minimum cost of changes needed to obtain an array, such that the greatest common divisor of all its elements is greater than 1.

Examples

Input

3 1 4

4 2 3

Output

1

Input

5 3 2

5 17 13 5 6

Output

8

Input

8 3 4

3 7 5 4 3 12 9 4

Output

13

Note

In the first sample the optimal way is to remove number 3 and pay 1 coin for it.

In the second sample you need to remove a segment [17, 13] and then decrease number 6. The cost of these changes is equal to 2·3 + 2 = 8 coins.

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/19/2019 23:10:49 (d2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|