I - Implementation Addict Editorial

Time Limit: 2 sec / Memory Limit: 256 MB

Problem

Wolf Sothe loves implementing online judge problems, he wants to solve as many problems as possible. However, if he keeps solving problems every day without a rest, day by day the number of problems that can be solved in a day will reduce.

So, sometimes Wolf Sothe takes a day off. On that day, Wolf Sothe will not solve any problem, then for the next day and later Wolf Sothe will be able to solve problems.

The number of problems that Wolf Sothe can solve in a day is as follows:

  • If that day is a working day, we define the number of days that Wolf Sothe has kept solving problems as kk (not including that day). Then Wolf Sothe can solve max(0,Ak×B)max(0, A − k \times B) problems during that day.
  • If that day is a rest day, during that day no problem will be solved.

Wolf Sothe wants to solve problems for NN days. Let the NN days be as a sequence from the 1st day to the NthN_{th} day. Suppose that Wolf Sothe doesn't solve problems before the 1st day.

In addition, we known in advance that there are some decided rest days.

A list of all the decided rest days will be given. For any other day, you can mark it as a rest day or a working day. Please find the maximum value of the number of problems that can be solved during NN days.


Input

Inputs will be given by standard input in following format

NN AA BB MM
t1t_1
t2t_2
:
tMt_M
  • For the first line, integer N(1N1,000,000,000)N(1≦N≦1,000,000,000), A(1A1,000,000,000)A(1≦A≦1,000,000,000), B(1B1,000,000,000)B(1≦B≦1,000,000,000), M(0M100,000)M(0≦M≦100,000) will be given divided by spaces. MM represents the number of the decided rest days.
  • From the second line there are MM additional lines to give the information about decided rest days. For the ithi_{th} line, an integer ti(1tiN)t_i(1≦t_i≦N) that represents the tit_i th decided rest day will be given. Please note that if i<ji < j, then ti<tjt_i<t_j

Output

Please output the maximum value of the number of problems that can be solved during NN days in one line.

Print a newline at the end of output.


Input Example 1Copy

Copy
5 6 2 0

Output Example 1Copy

Copy
20

Suppose that Wolf Sothe rest on the 3rd day and solve problems on the remaining 44 days.

  • For the 1st day, Wolf Sothe has kept solving problems for 00 day. Thus, max(0,60×2)=6max(0, 6 − 0 \times 2) = 6 problems.
  • For the 2nd day, Wolf Sothe has kept solving problems for 11 day. Thus, max(0,61×2)=4max(0,6 − 1 \times 2) = 4 problems.
  • For the 3rd day, Wolf Sothe rests. Thus, 00 problem.
  • For the 4th day, Wolf Sothe has kept solving problems for 00 day. Thus, max(0,60×2)=6max(0, 6 − 0 \times 2) = 6 problems.
  • For the 5th day, Wolf Sothe has kept solving problems for 11 day. Thus, max(0,61×2)=4max(0, 6 − 1 \times 2) = 4 problems.

In conclusion, 6+4+0+6+4=206 + 4 + 0 + 6 + 4 = 20 will be solved in total.


Input Example 2Copy

Copy
6 4 3 1
3

Output Example 2Copy

Copy
13

Input Example 3Copy

Copy
12 10 3 3
2
7
10

Output Example 3Copy

Copy
71


2025-04-07 (Mon)
05:38:11 +00:00