408609: GYM103202 I Rise of Shadows

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Rise of Shadowstime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard output

Azeroth is a world full of fantasy. In Azeroth, there are $$$H$$$ hours in a day and $$$M$$$ minutes in an hour.

You found a clock made from Azeroth. The clock has two hands — the hour hand and the minute hand. The two hands point to the same direction at the start of a day. Either hand rotates at a constant speed. The hour hand goes around a full circle in $$$H$$$ hours and the minute hand goes around a full circle in $$$M$$$ minutes. Surprisingly, it is night in Azeroth if and only if the angle between the two hands is less than or equal to $$$\alpha$$$.

Now you're wondering, given $$$\alpha = \frac{2 \pi A}{HM}$$$, how many integral moments (i.e., integer minutes since the start of the day) are there, such that the angle between the two hands is less than or equal to $$$\alpha$$$.

Input

The only line of the input contains three integers $$$H, M$$$ $$$(2\le H, M \le 10^{9})$$$ and $$$A$$$ $$$(0 \le A \le \frac{HM}{2})$$$, representing the number of hours in a day and the number of minutes in an hour, and the limit of the angle in radians, respectively.

Output

Print an integer representing the answer.

ExamplesInput
5 5 4
Output
9
Input
3 5 1
Output
3

加入题单

上一题 下一题 算法标签: