PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000123. Táo đỏ, táo xanh và táo không màu (Red and Green Apples)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Táo đỏ, táo xanh và táo không màu (Red and Green Apples)

Red and Green Apples

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

You must eat exactly XX red and YY green apples. There are AA red apples with values pip_i, BB green apples with values qiq_i, and CC colorless apples with values rir_i, each of which can become either color. Maximize total tastiness.

Input

The first line has X,Y,A,B,CX,Y,A,B,C, then three lines with AA values pip_i, BB values qiq_i, and CC values rir_i.

Output

Print the maximum total tastiness.

Subtasks

  • Subtask 1 (20 points): 1≤X≤A≤151\le X\le A\le 15; 1≤Y≤B≤151\le Y\le B\le 15; 1≤C≤151\le C\le 15; 1≤pi,qi,ri≤1091\le p_i,q_i,r_i\le10^9.
  • Subtask 2 (30 points): 1≤X≤A≤8001\le X\le A\le 800; 1≤Y≤B≤8001\le Y\le B\le 800; 1≤C≤8001\le C\le 800; 1≤pi,qi,ri≤1091\le p_i,q_i,r_i\le10^9.
  • Subtask 3 (50 points): 1≤X≤A≤1000001\le X\le A\le 100000; 1≤Y≤B≤1000001\le Y\le B\le 100000; 1≤C≤1000001\le C\le 100000; 1≤pi,qi,ri≤1091\le p_i,q_i,r_i\le10^9.

Examples

Input

1 1 2 2 2
5 2
4 1
10 3

Output

15

Explanation

Taking red 55 and green 44 yields 99. Replacing green 44 by colorless 1010 (colored green) yields the optimum 1515.