100 atcoder#ABC207B. [ABC207B] Hydrate

[ABC207B] Hydrate

Score : 200200 points

Problem Statement

There is a container with AA cyan balls. Takahashi will do the following operation as many times as he likes (possibly zero times):

  • add BB cyan balls and CC red balls into the container.

Takahashi's objective is to reach a situation where the number of cyan balls in the container is at most DD times the number of red balls in it.

Determine whether the objective is achievable. If it is achievable, find the minimum number of operations needed to achieve it.

Constraints

  • 1A,B,C,D1051 \leq A,B,C,D \leq 10^5
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

AA BB CC DD

Output

If Takahashi's objective is achievable, print the minimum number of operations needed to achieve it. Otherwise, print -1.

5 2 3 2
2

Before the first operation, the container has 55 cyan balls and 00 red balls. Since 55 is greater than 00 multiplied by D=2D=2, Takahashi's objective is not yet achieved.

Just after the first operation, the container has 77 cyan balls and 33 red balls. Since 77 is greater than 33 multiplied by 22, the objective is still not achieved.

Just after the second operation, the container has 99 cyan balls and 66 red balls. Since 99 is not greater than 66 multiplied by 22, the objective is achieved.

Thus, the answer is 22.

6 9 2 3
-1

No matter how many times Takahashi repeats the operation, his objective will never be achieved.