Given two coins of denominations “X” and “Y” respectively, find the largest amount that cannot be obtained using these two coins (assuming infinite supply of coins) followed by the total number of such non obtainable amounts, if no such value exists print “NA”.
The first line of input contains an integer T denoting the number of test cases.
Each test case consist of two integers X and Y in a single line separated by a space.
Print an integer which represents largest amount that cannot be obtained using these two coins followed by another integer which represents the total number of such non obtainable amounts. If no such value exists print “NA”.
1 ≤ T ≤ 70
2 ≤ M ≤ 104
2 ≤ N ≤ 104
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.