Dassu And Business
Difficulty: Hard

Dassu is very disturbed since the brutal murdur of her pet mosquito. As such, she is unable to concentrate on her studies.
So, she decided to step into business.<br>
   
   She had learnt that she had to deal with **2 type of people - Dealers and Customers**.
There are **N dealers** and **M customers**. Also, there are **P types of products**.

Dealer i provides each item at cost **CP<sub>i</sub>** and has **A<sub>ij</sub>** units of j-th item.
Customer i buys each item at **SP<sub>i</sub>**   and requires at the most **B<sub>ij</sub>** units of j-th item.<br>
(If a dealer has X items of some type, it is **not necessary** that you purchase all X items. You can purchase any number of items between **0 to X(both inclusive)** . Similiary, if a customer can buy X products of a type, it is **not necessary** to give him exact X products. Rather you can give him any number of items from **0 to X(both inclusive)** to him, **depending upon your profit** .)

Now she has **R rupees** initially.
 She knows that **dealers come in early morning** so as to sell their items as soon as possible.
 She also knows that the **customers come in at night** after their office.
 <br><br>So what is the **maximum profit that she can make today?** Assume dealers gives no loan.
 <br><br>
###INPUT FORMAT
 
 The **First Line** of Input will have 4 Integers - **N, M, P** & **R**.<br>
 The **next line** will have **N** integers, the rate of every dealer (CP<sub>i</sub> is the rate at which i-th dealer provides all the products).<br>
 The **next line** will have **M** integers, the Selling Price for every customer(SP<sub>i</sub> is the rate at which i-th customer buys all the products).<br>
 The **next N lines** will have **P integers each**. It will represent the matrix **A[][]**.<br>
 The **next M lines** will have **P integers each**. It will represent the matrix **B[][]**.<br>
 
###OUTPUT FORMAT

Output a **Single Integer** corresponding to the **maximum profit** Miss Dassu can make today.

###CONSTRAINTS

1<= N,M,P,R <=1000<br>
0<= A<sub>ij</sub>, B<sub>ij</sub>, CP<sub>i</sub>, SP<sub>i</sub> <= 1000<br>
The Sum of all A<sub>ij</sub> will not exceed 1000<br>
The Sum of all B<sub>ij</sub> will not exceed 1000<br>

###EXAMPLE

**INPUT :**
<br><br>
3 2 2 3<br>
1 2 3<br>
4 5<br>
1 2<br>
1 3<br>
2 3<br>
0 2<br>
3 1<br>
<br><br>
**OUTPUT :**
<br><br>
11<br><br>
**EXPLANATION**
<br><br>Dassu has 3 rupees in the begining. She can buy 1 item<sub>1</sub> and 2 item<sub>2</sub> from dealer<sub>1</sub>. The cost will be 1 rupees each, i.e. 3 rupees. She can sell 1 item<sub>1</sub> and 1 item<sub>2</sub> to customer<sub>2</sub> at 5 rupees each, and 1 item<sub>2</sub> to customer<sub>1</sub> at 4 rupees. So she sells them for 14 rupees, making a profit of 11.

Input Format:

Output Format:

Sample Input:

Sample Output:

Python 3 starter code:


Reference solution (Unknown):
<br><br>[CODE](http://ideone.com/z3TwMM)