#t240. 苹果和虫子2

苹果和虫子2

Apples and Worms 2

Problem Description

You bought a box of nn apples, but unfortunately a worm had gotten mixed into the box. The worm can eat one apple every xx hours, and it will not start on another apple until it has finished the current one. After yy hours, how many intact apples do you still have?

Input Format

One line containing n,xn, x and yy (all integers).

Output Format

One line containing the number of remaining apples.

Sample Input

10 4 9

Sample Output

7

Hint

  • Same model as "Apples and Worms": round the number eaten up to the ceiling; do not let the answer go negative.
  • Here xx is guaranteed to be at least 11, so you need not worry about division by zero.
  • Check against the sample: 10 4 9 → 7.