The creative department at the PuimTV has just created a new television game: “One Against Many”. In this game, one player plays against a set of opponents. The player and the opponents are collectively called participants. The game proceeds in a sequence of rounds until the player or all his opponents lose. In each round, the participants should answer a question about some subject. The player or an opponent loses when he answers wrongly. If no participant loses, a new question of the same subject is posed until some participant loses. If the player loses, the game ends and he wins no money. If an opponent loses, he is excluded from the game (i.e., he will not participate in any of the following rounds). In each round, the player can win, at most, a constant amount of money, R. The actual amount of money won by the player is an integer that depends on the number of opponents at the beginning of the round, O, and the number of opponents that lose in the round, L, using the formula: f loor(R ∗ L/O) (with f loor(x) the largest integer not greater than x). In the game, there is a fixed set of subjects, {s1, s2, . . . , sn}. The subject for each round is given by the following cyclic sequence: s1, s2, . . . , sn, s1, s2, . . . , sn, s1, . . . The subject of the first round is subject s1. For each subject, si, there is an associated price, pi, with pi a percentage value (0 ≤ pi < 100). For playing a round with subject si, the player must pay floor(T ∗ pi/100), with T the total amount of money won by the player since the beginning of the game. In the beginning of the game, T = 0. The financial department of PuimTV is now trying to evaluate the financial impact of the game to decide the number of opponents, the number of subjects and the price of each subject that PuimTV will use. To this end, you have been asked to create a program that computes the maximum amount of money a player can win. Given the initial number of opponents, Oinit, in the game, the maximum amount of money a player can win in each round, R, the number of subjects, N, and their prices, pi, your task is to create a program that computes the maximum amount of money a player can win in the “One Against Many” game. Input The first line of input contains an integer, G (0 < G < 50), that specifies the number of game config- urations to analyze. The rest of the input contains a sequence of G game configurations. Each game configuration is specified as follows: The first line of input contains an integer, Oinit (0 < Oinit ≤ 2500), that specifies the number of initial opponents. The second line of input contains an integer, R (Oinit ≤ R ≤ 5000), that specifies the amount of money the player can win in each round. The third line of input contains an integer, N (0 < N ≤ 50), that specifies the number of different subjects. Each of the following N input lines contains an integer, pi for line i (0 ≤ pi < 100, i = 1..N ), that specifies the price of each of the N subjects (as defined earlier). Output Your program must output a sequence of lines, each one containing an integer, with the maximum amount of money the player can win in each configuration (using the same order as the input file).
2/2 Sample Input 2 3 100 2 80 20 3 100 2 20 80 Sample Output 153 146