P13130 [HackerEarth] milly and chocolates iv 6
普及
题目描述

Milly loves to eat chocolates. She has N different chocolates. She needs to choose only one of them. At the moment, i^{th} chocolate already has P_{i} pieces. The j^{th} piece of the i^{th} chocolate requires T_{i,j} seconds to eat. Milly knows that she will take K seconds to break one piece from any chocolate and wait for M seconds after eating any piece.

Your task is to help her in selecting a chocolate that she will eat completely in minimum possible time (including the waiting time).

Input:

First line of the input will contain a single integer T denoting the number of test cases. Now for every test case, the first line will contain three space separated integers : N, K and M. The next line will contain N space separated integers denoting P_{i} (The number of pieces in the i^{th} chocolate). Each of the next N lines will contain j space separated integers denoting T_{i,j} (Time (in seconds) required to eat j^{th} piece of the i^{th} chocolate.

Output:

For every test case, print two space separated integers in a new line : the index (1-based) of the resultant chocolate and the minimum number of seconds Milly needs to eat that chocolate. If multiple answers are possible then consider the lowest indexed chocolate.

Constraints:

1 ≤ T ≤ 10

1 ≤ N ≤ 10^3

1 ≤ K,M ≤ 10^5

1 ≤ P_{i} ≤ 100

1 ≤ T_{i,j} ≤ 10^9

SAMPLE INPUT
1
2 10 10
1 2
10
4 2

SAMPLE OUTPUT
1 20

输入格式

见题面

输出格式

见题面

样例输入
1 2 10 10 1 2 10 4 2 SAMPLE
样例输出
1 20