B. [ABC318A] Full Moon

    传统题 1000ms 256MiB

[ABC318A] Full Moon

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Statement

Takahashi likes full moons.

Let today be day 11. The first day on or after today on which he can see a full moon is day MM. After that, he can see a full moon every PP days, that is, on day M+PM+P, day M+2PM+2P, and so on.

Find the number of days between day 11 and day NN, inclusive, on which he can see a full moon.

Constraints

  • 1N2×1051 \le N \le 2 \times 10^5
  • 1MP2×1051 \le M \le P \le 2 \times 10^5
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NMP

Output

Print the answer as an integer.


Sample1

13 3 5
3

He can see a full moon on day 33, 88, 1313, 1818, and so on.

From day 11 to 1313, he can see a full moon on three days: day 33, 88, and 1313.


Sample2

5 6 6
0

There may be no days he can see a full moon.


Sample3

200000 314 318
628

Programming exercise on 21 August

未参加
状态
已结束
规则
XCPC
题目
4
开始于
2024-8-21 17:30
结束于
2024-8-21 18:30
持续时间
1 小时
主持人
参赛人数
2