## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## Four Arrays CodeChef Solution | CodeChef Problem Solution 2022

You have been given an integer $K$ and four arrays $A$$B$$C$, and $D$ with sizes ${S}_{A}$${S}_{B}$${S}_{C}$ and ${S}_{D}$ respectively.

• Pick four indices $x$$y$$z$, and $w$ from arrays $A$$B$$C$, and $D$ respectively. Note that $\left(1\le x\le {S}_{A}\right)$$\left(1\le y\le {S}_{B}\right)$$\left(1\le z\le {S}_{C}\right)$ and $\left(1\le w\le {S}_{D}\right)$.
• There are in total ${S}_{A}×{S}_{B}×{S}_{C}×{S}_{D}$ ways to do the above step. For each way, write down the value of $\left({A}_{x}+{B}_{y}\right)×\left({C}_{z}+{D}_{w}\right)$ on a board.
• Sort all the numbers written on the board in non-decreasing order.

Find the ${K}^{th}$ element written on the board.

### Input Format

• First line contains five integers ${S}_{A}$${S}_{B}$${S}_{C}$${S}_{D}$ and $K$.

• The second line contains ${S}_{A}$ space-separated integers ${A}_{1},{A}_{2},...,{A}_{{S}_{A}}$ denoting the array $A$.
• The third line contains ${S}_{B}$ space-separated integers ${B}_{1},{B}_{2},...,{B}_{{S}_{B}}$ denoting the array $B$.
• The fourth line contains ${S}_{C}$ space-separated integers ${C}_{1},{C}_{2},...,{C}_{{S}_{C}}$ denoting the array $C$.
• The fifth line contains ${S}_{D}$ space-separated integers ${D}_{1},{D}_{2},...,{D}_{{S}_{D}}$ denoting the array $D$.

### Output Format

For each test case, output the required number in a single line .

### Constraints

• $1\le {S}_{A},{S}_{B},{S}_{C},{S}_{D}\le 3\cdot {10}^{4}$
• $1\le K\le {S}_{A}×{S}_{B}×{S}_{C}×{S}_{D}$
• $0\le {A}_{i},{B}_{i},{C}_{i},{D}_{i}\le {10}^{5}$

### Sample Input 1

2 1 3 2 10
2 3
2
1 1 2
3 1


### Sample Output 1

20


### Explanation

After sorting the numbers on the board are in the following order $\left\{8,8,10,10,12,15,16,16,20,20,20,25\right\}$. So, the ${10}^{th}$ number is $20$.