All submissions for this problem are available.
Mehul is very fond of sweets. He has N boxes containing sweets.
The first box contains 1 sweet, second box contains 2 sweets and so on...
Seeing Mehul's love for sweets Fairy of SweetLand decides to reward him, she casts a magical spell of power K on his boxes.
She now instructs him to transfer the sweets of first box to second and second to third and so on, until all the sweets are in the last box.
When Mehul, transfers the sweets from i th box to i+1 th box, because of Fairy's spell additional K sweets magically appears in i+1 th box.
This process is carried on till all the sweets are contained in the last box.
Now Mehul wants to find how many sweets he has .
- The first line of the input contains an integer T denoting the number of test cases . The description of T testcases follow.
- The first line of each test case contains two space seperated integers N K denoting the Number of boxes , power of magic spell .
For each test case, output the number of sweets Mehul will have.
- 1 ≤ T ≤ 100
- 2 ≤ N ≤ 500
- 1 ≤ K ≤ 20
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions