Олимпиадный тренинг

Задача 32971. Comet Barmaley


Задача

Темы: Вывод формулы
Comet Barmaley is known to be visible from Earth every C years. Curiously, this happens in years divisible by C, i.e. C, 2xC, 3xC, etc. Not everyone is destined to see this comet at least once in their life. However, there are happy centenarians who made her arrive even several times.
It is believed that for the first time this comet was seen and documented by the famous medieval astronomer Barmaleo Barmaley. In honor of him, she got her name. They say that during his long life he managed to make many great discoveries in various fields of science. However, recently historians have begun to doubt whether Barmaleo Barmalei made all the discoveries attributed to him. In particular, they were interested in how many times in his life a scientist could see a comet named after him.
 
Barmaleo Barmalei was born on January 1st in year A and died on December 31st in year B. How many times during his lifetime was a comet visible from Earth? We believe that he could see the comet even as a baby or a very old man, i.e. if she arrived in year A or B.

The program takes as input three integers A, B and C (1 ≤ A ≤ B ≤ 2×109 , 1 ≤ C ≤ 2×109 ) and should output a single integer – number of times the comet has been
visible between years A and B inclusive.

Enter Output Note
1850
1900
50
2 The comet flew near the Earth in 1850 and 1900. Barmaleo Barmalei caught both times.