AtCoder Beginner Contest 207
B
Hydrate
AtCoder
⌀ 0
原题
← AC →
翻译中…

Problem Statement

翻译中…

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

翻译中…
  • add $B$ cyan balls and $C$ 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 $D$ 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

翻译中…
  • $1 \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:

翻译中…

A B C D

翻译中…

Output

翻译中…

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

翻译中…

样例

Input #1
5 2 3 2
Output #1
2
Before the first operation, the container has $5$ cyan balls and $0$ red balls. Since $5$ is greater than $0$ multiplied by $D=2$, Takahashi's objective is not yet achieved. Just after the first operation, the container has $7$ cyan balls and $3$ red balls. Since $7$ is greater than $3$ multiplied by $2$, the objective is still not achieved. Just after the second operation, the container has $9$ cyan balls and $6$ red balls. Since $9$ is not greater than $6$ multiplied by $2$, the objective is achieved. Thus, the answer is $2$.
Input #2
6 9 2 3
Output #2
-1
No matter how many times Takahashi repeats the operation, his objective will never be achieved.
题目信息
题号
abc207_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。