Nth Multiple
Submissions: 313   Accuracy:

18.86%

  Difficulty: Basic   Marks: 1

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. 

Example : 
Input : 

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

Output : 
Position of Nth multiple of A in the given series(indexing starting from 1)

Constraints :
1 ≤ T ≤ 50
1 ≤ N ≤ 10^8
1 ≤ A ≤ 10^8


Input : 
2
5
4
2
3

Output : 
30
8

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

Contributor: Mohit Gupta _OMG :)
Author: Mohit Gupta 4


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.