Another Goose Goose Duck Problem

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

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 aa 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 aa to be an arbitrary integer in \[,r]\[\ell,r].

Teacher Rice meets a goose every bb 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 kk geese.

입력

There are four integers in one line: \ell, rr, bb, kk (1r1091\leq \ell\leq r\leq 10^9, 1b,k1091\leq b,k\leq 10^9).

출력

Output one integer denotes the time Teacher Rice needs to kill kk geese.