CF BUDDY
← Problems·

990E · Post Lamps

2100 · brute force, greedy

Problem: Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has nn positions to install lamps, they correspond to the integer numbers from 00 to n1n - 1 on the OX axis. However, some positions are blocked and no post lamp can be placed there.

There are post lamps of different types which differ only by their power. When placed in position xx, post lamp of power ll illuminates the segment [x;x+l][x; x + l]. The power of each post lamp is always a positive integer number.

The post lamp shop provides an infinite amount of lamps of each type from power 11 to power kk. Though each customer is only allowed to order post lamps of exactly one type. Post lamps of power ll cost ala_l each.

What is the minimal total cost of the post lamps of exactly one type Adilbek can buy to illuminate the entire segment [0;n][0; n] of the street? If some lamps illuminate any other segment of the street, Adilbek does not care, so, for example, he may place a lamp of power 33 in position n1n - 1 (even though its illumination zone doesn't completely belong to segment [0;n][0; n]).

Input Format: The first line contains three integer numbers nn, mm and kk (1kn1061 \le k \le n \le 10^6, 0mn0 \le m \le n) — the length of the segment of the street Adilbek wants to illuminate, the number of the blocked positions and the maximum power of the post lamp available.

The second line contains mm integer numbers s1,s2,,sms_1, s_2, \dots, s_m (0s1<s2<sm<n0 \le s_1 < s_2 < \dots s_m < n) — the blocked positions.

The third line contains kk integer numbers a1,a2,,aka_1, a_2, \dots, a_k (1ai1061 \le a_i \le 10^6) — the costs of the post lamps.

Output Format: Print the minimal total cost of the post lamps of exactly one type Adilbek can buy to illuminate the entire segment [0;n][0; n] of the street.

If illumintaing the entire segment [0;n][0; n] is impossible, print -1.

Sample Cases

Case 1

Input

6 2 3
1 3
1 2 3

Output

6

Case 2

Input

4 3 4
1 2 3
1 10 100 1000

Output

1000

Case 3

Input

5 1 5
0
3 3 3 3 3

Output

-1

Case 4

Input

7 4 3
2 4 5 6
3 14 15

Output

-1

Similar problems

00:00:00
Loading editor…
Welcome! I'm your coding tutor for this problem. Use the chips below to reveal stored hints or get AI feedback on your code. I'll guide you step by step — never giving away the solution.

Sign in to unlock AI tutor feedback