Ice Bucket Challenge

No attempts yetTime limit1sMemory limit256 MB

Problem

The Ice Bucket Challenge collects donations for amyotrophic lateral sclerosis (ALS). Every participant picks one of two options.

  • Pour ice water over yourself and donate 10 baht, then challenge KK friends to take part.
  • Skip the ice water and donate 100 baht. In this case you cannot challenge anyone.

A challenged friend picks between the same two options. Everyone who is challenged takes part, and nobody breaks the rules. Nobody pours the ice water and then donates an amount other than 10 baht.

Starting from a single participant, you want the donations to total at least GG baht. Find the smallest number of people who have to pour ice water over themselves. GG is guaranteed to be a multiple of 10.

Input

The first line has the number of test cases TT, where T<100T < 100.

Each of the next TT lines holds one test case: two positive integers GG and KK separated by a single space, with G107G \le 10^7 and K<1000K < 1000.

Output

For each test case, print on its own line the smallest number of people who have to pour ice water over themselves.

Hint

For G=60G = 60 and K=10K = 10, the first participant donates 100 baht and challenges nobody, which already passes the goal. No one pours ice water.

For G=320G = 320 and K=2K = 2, the first participant pours ice water, donates 10 baht and challenges two people. One of those two pours ice water, donates 10 baht and challenges two more. The remaining three each donate 100 baht. The total is 320 baht and two people poured ice water.