14101410 SUSTech Online Judge
Problem 1410 --TOEFL preparation

1410: TOEFL preparation

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 101  Solved: 54
[Submit][Status][Web Board]


Pisces is preparing TOEFL exam recently. The TOEFL exam has four parts: Reading, Listening, Speaking, and Writing. Each has 30 points, thus, 120 points in total. In Pisces last exam, he got \(a\), \(b\), \(c\), and \(d\) on these four parts, respectively. It is known that \(w\), \(x\), \(y\), and \(z\) days of efforts are needed to improve one point of each part in TOEFL exam. To get 100 points, Pisces wants to know the minimum number of days he needs to work. 


The first line contains a single integer \(T (1\leq T\leq 100)\), which represents the number of test cases.  
Each test case has two lines. The first line contains four integers \(a\), \(b\), \(c\), and \(d (0\leq a, b, c, d\leq 30)\), representing the points of each part in Pisces’ last exam. The second line contains four integers \(w\), \(x\), \(y\), and \(z(1\leq w, x, y, z\leq 100)\), representing the number of days that Pisces needs to improve one point in each section. 


For each test case, print the answer. 

Sample Input

25 24 23 24
3 2 5 4
28 26 23 22
2 4 1 5

Sample Output