Sweet Earnings at Codedamn

Easy
1
41.2% Acceptance

At Codedamn's candy lab, there's a total of 100100 chocolates available for sale.

Each day, the goal is to sell XX chocolates, with a reward of 11 rupee for every chocolate sold up to the goal. For any chocolates sold beyond this daily target, the reward doubles to 22 rupees for each additional chocolate.

Given that YY chocolates are sold in a particular day, your task is to calculate the total earnings of the day.

Format for input

  • The first line will contain a single integer TT, representing the number of test cases.
  • For each test case, there will be two space-separated integers XX and YY — the daily sales target, and the actual number of chocolates sold.

Format for output

For every test case, print on a new line the total earnings for that day.

Constraints

  • 1T1001 \leq T \leq 100
  • 1X,Y101 \leq X, Y \leq 10

Sample Test Cases (and explanation)

Case #1:

Input:

4 3 1 5 5 4 7 2 3

Output:

1 5 10 4

Explanation

Test case 11: The daily sales target was 33. Only 11 chocolate was sold, earning 11 rupee.

Test case 22: The daily sales target was 55. With 55 chocolates sold, the total earnings were 55 rupees.

Test case 33: The daily sales target was 44. Selling 77 chocolates led to earnings of 44 rupees for the first 44 chocolates and an additional 22 rupees per chocolate for the extra 33 chocolates, making a total of 1010 rupees.

Test case 44: The daily sales target was 22. Selling 33 chocolates resulted in earnings of 22 rupees for the first 22 chocolates and an additional 22 rupees for the extra chocolate, totaling 44 rupees.