Training Site
Sideways banner

President Grump

Input: Standard Input (stdin)
Output: Standard Output (stdout)
Memory limit: 100 megabytes
Time limit: 1.0 seconds

President Grump of Nevermoreland is to be given a cognitive test by a doctor to see if the president is fit for purpose. One of the tests is to successively subtract 7 from 100 until he reaches the smallest positive number. The doctor doesn’t care what the intermediate values are – just that the person tested ends up with the correct last value. But someone in the opposition rightly pointed out that President Grump might just rote learn them. Your job is to help the test doctor deliver a meaningful test. Let her enter any starting number and what value is to be subtracted. Output should be the final number, followed by a count of how many subtractions are required to reach that number.


There are two lines, each containing one positive whole number. The first contains S, representing the starting number, the second contains D, representing the amount to be successively subtracted.


Print the final value, followed by a space, followed by the number of subtractions required.

  • 0 \le S \le 1000
  • 0\le D\le 1000

Example 2 shows that 0 should be treated as a positive number.

  • Sample Input 1


    Sample Output 1

    2 14
  • Sample Input 2


    Sample Output 2

    0 10