There is a castle with n wall segments. The castle is going to be under attack. The enemies can attack from ground or air.
You need to fortify the castle's defenses. You can hire wizards, archers or soldiers for this.
Each segment has two parameters air durability and land durability.
Air durability is sum of archers and wizards assigned to the segment and land durability is sum of soldiers and wizards assigned to the segment. Strength of a segment is minimum of air durability and land durability of the segment.
You are given number of currently assigned wizards, archers and soldiers in each segment. You cannot change current distribution but you have to add up to hW wizards, hA archers and hS soldiers such that strength of castle is maximum possible.
Strength of castle is defined to be minimum of strength of all segments.
The first line of the input contains a single integer T denoting the number of test cases.
The first line of each test case contains four integers n, hA, hW, hS.
Next 3 lines each contain n integers- archers, wizards and soldiers assigned to ith segment Ai, Mi, Si respectively.
Print one integer- Maximum achievable strength of castle.
1 ≤ T ≤ 10
1 ≤ n ≤ 105
1 ≤ Ai, Mi, Si ≤ 1018
1 ≤ hA, hW, hS ≤ 1018