eolymp
bolt
Try our new interface for solving problems
Problems

Railway Tickets

Railway Tickets

Time limit 1 second
Memory limit 123 MiB

The railway line "Yekaterinburg-Sverdlovsk" with several stations has been built. This railway line can be represented as a line segment, railway stations being points on it. The railway line starts at the station "Yekaterinburg" and finishes at the station "Sverdlovsk", so stations are numbered starting from "Yekaterinburg" (it has number 1) and "Sverdlovsk" is the last station.

Cost of the ticket between any two stations depends only on a distance between them. The prices for the tickets are specified in the following table.

Direct tickets from one station to another can be booked if and only if the distance between these station does not exceed L_3. So sometimes it is necessary to book several tickets to pay for the parts of the whole way between stations.

For example, on the railway line shown at the figure above there are seven stations. The direct ticket from the second station to the sixth one can not be booked. There are several ways to pay for the travel between these stations. One of them is to book two tickets: one ticket at price C_2 to travel between the second and the third stations, and other at price C_3 to travel between the third and the sixth stations. Note, that though the distance between the second and the sixth stations is equal to 2L_2, the whole travel can not be paid by booking two tickets at price C_2, because each ticket is valid for only one travel and each travel should start and end only at stations.

Your task is to write a program, that will find the minimal cost of the travel between two given stations.

Input data

The first line of the input contains 6 integers L_1, L_2, L_3, C_1, C_2, C_3 (1 L_1 < L_2 < L_310^9, 1 C_1 < C_2 < C_310^9) in the specified order with one space between. The second line contains the amount of stations N (2 N 10000). The third line contains two different integers separated by space. They represent serial numbers of stations, the travel between which must be paid. Next N - 1 lines contain distances from the first station ("Yekaterinburg") on the railway line to others. These distances are given as different positive integers and are arranged in the ascending order. The distance from "Yekaterinburg" to "Sverdlovsk" does not exceed 10^9. The distance between any neighboring stations does not exceed L_3. The minimal travel cost between two given stations will not exceed 10^9.

Output data

Program should print to the output the only number, which is the minimal travel cost between two given stations.

Examples

Input example #1
3 6 8 20 30 40
7
2 6
3
7
8
13
15
23
Output example #1
70
Author Pavel Zaletsky
Source 1999 III Ural Collegiate Programming Contest, Ekaterinburg, March 19 - 20, Problem D