You are given a series 1, 1, 2, 3, 5, 8,.... . Your task is to tell the position of Nth multiple of a number - A. Both A and Nth multiple are part of the given series.
The first line of input contains an integer T denoting the Test cases. Then T test cases follow.
Second line contains Skill value of N
Third line contains Skill value of A
Position of Nth multiple of A in the given series(indexing starting from 1)
1 ≤ T ≤ 50
1 ≤ N ≤ 10^8
1 ≤ A ≤ 10^8
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.