fork(1) download
  1. t=int(input())
  2. while(t>0):
  3. t=t-1
  4. arr=input().split() #if x and n in same line!!!!
  5. x=int(arr[0])
  6. n=int(arr[1])
  7. noc=x
  8. while(noc>=n):
  9. x=x+1
  10. noc=noc-n+1
  11. print(x)
Success #stdin #stdout 0.15s 10224KB
stdin
2
15 3
34 3
stdout
22
50