QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#14255. Making A Meowth

統計

“通往成功的门票!”

在输给火箭队之后,你得出了一个显而易见的结论:击败他们的唯一方法就是教会你自己的喵喵读书。

为了防止过度劳累,你制定了以下学习计划:你的喵喵将阅读所有页码是 $N$ 的倍数的页,而你将大声朗读其余的所有页给它听。但是,因为你还有其他事情要做(捕捉宝可梦、赢得对战等等),你每次只愿意读 $P$ 页。你总是先读(书从第 1 页开始)。当你读完你的最后一页后,如果紧接着的下一页轮到喵喵读,就让它读;毕竟,你希望它尽可能多地练习!否则,一旦你读完最后一页,本次学习就结束了(即使喵喵最终一页也没读)。如果你读一页需要 $X$ 分钟,而你的喵喵读一页需要 $Y$ 分钟,那么你们一起读书总共会花费多少分钟?

输入格式

输入唯一的一行包含 4 个空格分隔的正整数 $N, P, X, Y$($2 \le N, P \le 10^7$,$1 \le X, Y \le 60$)。

输出格式

输出一行,包含一个整数:你和你的喵喵一起读书所花费的总时间(以分钟为单位)。

样例

输入样例 1

4 10 2 3

输出样例 1

29

输入样例 2

3 14 2 5

输出样例 2

63

输入样例 3

10 4 2 3

输出样例 3

8

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.