Timer is Running

Cereals Box
##### Submissions: 1066   Accuracy: 10.06%   Difficulty: Easy   Marks: 2

You are given Pi kg of a cereal in different boxes daily and you hate it. You can daily choose any of the cereal boxes you have and remove 10 % of amount of the cereals in the box or K kg whichever is more. If the box you choose has less than K Kg of cereal left in it, you can empty the box. Your task is to minimize the amount of cereals you have with yourself at the end of N days.

Input:

The first line of the input contains an integer T denoting number of test cases. First line of each test case contains two integers N and K. Second line of the test case contains N space separated integer Pi denoting the amount of cereals (in kg) which you are given on the ith day.

Output:

For each test case, if W is the amount of cereals you have left with yourself at the end, print the highest integer less than or equal to W.

Constraints:

1<=T<=3.3*10^3
1<=N<=10^3
1<=K<=10^2
1<=Pi<=10^3

Example:

Input:

1
2 10
100 15

Output:

95

Explanation:

You will remove 10 kg from the first box on first day and second day.

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: ShivamKD

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.