| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 254 | 117 | 94 | 48.454% |
Teacher Rice likes playing the famous game 'Goose Goose Duck'. In the game, Teacher Rice plays a duck and his goal is to kill the geese. Every time he kills a goose, he should wait $a$ seconds for his killing skill to cool down. Since Teacher Rice's role is the Serial Killer, the time Teacher Rice waits depends on which type of goose he kills. Because Teacher Rice is a skilled killer, he can make the waiting time $a$ to be an arbitrary integer in $[\ell,r]$.
Teacher Rice meets a goose every $b$ seconds. Once Teacher Rice meets a goose, he can choose to kill the goose if his killing skill is ready, otherwise the goose runs away immediately and he can not kill this goose.
Teacher Rice wants to know the minimum time he needs to kill $k$ geese.
There are four integers in one line: $\ell,ドル $r,ドル $b,ドル $k$ (1ドル\leq \ell\leq r\leq 10^9,ドル 1ドル\leq b,k\leq 10^9$).
Output one integer denotes the time Teacher Rice needs to kill $k$ geese.
6 6 3 3
18
2 3 5 4
20