Codeforces Round 206 (Div. 2)
B
Vasya and Public Transport
Codeforces
1100
原题
← AC →
翻译中…

Vasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has $*n*$ buses and $*m*$ trolleys, the buses are numbered by integers from $1$ to $*n*$, the trolleys are numbered by integers from $1$ to $*m*$.

翻译中…

Public transport is not free. There are 4 types of tickets:

翻译中…
  1. A ticket for one ride on some bus or trolley. It costs $*c*_{1}$ burles;
  2. A ticket for an unlimited number of rides on some bus or on some trolley. It costs $*c*_{2}$ burles;
  3. A ticket for an unlimited number of rides on all buses or all trolleys. It costs $*c*_{3}$ burles;
  4. A ticket for an unlimited number of rides on all buses and trolleys. It costs $*c*_{4}$ burles.
翻译中…

Vasya knows for sure the number of rides he is going to make and the transport he is going to use. He asked you for help to find the minimum sum of burles he will have to spend on the tickets.

翻译中…

Input

翻译中…

The first line contains four integers $*c*_{1}, *c*_{2}, *c*_{3}, *c*_{4}$ $(1 ≤ *c*_{1}, *c*_{2}, *c*_{3}, *c*_{4} ≤ 1000)$ — the costs of the tickets.

翻译中…

The second line contains two integers $*n*$ and $*m*$ $(1 ≤ *n*, *m* ≤ 1000)$ — the number of buses and trolleys Vasya is going to use.

翻译中…

The third line contains $*n*$ integers $*a*_{*i*}$ $(0 ≤ *a*_{*i*} ≤ 1000)$ — the number of times Vasya is going to use the bus number $*i*$.

翻译中…

The fourth line contains $*m*$ integers $*b*_{*i*}$ $(0 ≤ *b*_{*i*} ≤ 1000)$ — the number of times Vasya is going to use the trolley number $*i*$.

翻译中…

Output

翻译中…

Print a single number — the minimum sum of burles Vasya will have to spend on the tickets.

翻译中…

Note

翻译中…

In the first sample the profitable strategy is to buy two tickets of the first type (for the first bus), one ticket of the second type (for the second bus) and one ticket of the third type (for all trolleys). It totals to $(2·1) + 3 + 7 = 12$ burles.

翻译中…

In the second sample the profitable strategy is to buy one ticket of the fourth type.

翻译中…

In the third sample the profitable strategy is to buy two tickets of the third type: for all buses and for all trolleys.

翻译中…

样例

Input #1
1 3 7 19
2 3
2 5
4 4 4
Output #1
12
InputCopy OutputCopy
Input #2
4 3 2 1
1 3
798
1 2 3
Output #2
1
InputCopy OutputCopy
Input #3
100 100 8 100
3 5
7 94 12
100 1 47 0 42
Output #3
16
InputCopy OutputCopy
题目信息
题号
355B
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。