While locked away in prison, old uncle Rohi decides to get in shape. While doing crunches, push-ups, and other favorties, Rohi gets bored. To spice things up, he defines a few fun rules to amend his counting style
- He will pick some integer X to start counting from.
- He will pick some integer N to count by.
- When he gets to the number 2147483647, his count overflows, down to -2147483648.
- He follows the rules for basic 32 bit signed integer overflow.
- He will stop his exercise when his count gets to 3.
- He is wise enough to pick only numbers that will allow him to stop.
As a guard, you get bored too, so you decide to figure out how many repetitions of each exercise Rohi will do with given values for X and N.
You will be given an unknown number of datasets, each only one line long. Each line consists of the problem number P, (1 ≤ P ≤ 100), followed by two integers, X and N, the two values that Rohi is using.
1 7 9 2 60 31 3 10 11 4 5 10 5 53 6
For each dataset, output one line beginning with the problem number P, then a space character, then the number of repetitions Rohi makes.
1 477218588 2 3048041305 3 3904515723 4 858993459 5 1431655757