#P1648. Countryside Highway
Countryside Highway
Description
Regional government wishes to build a new highway across the region, and it seems that the best route for the highway goes across the Kvadratnaya village. The village consists of the N x N square estates. All estates have a size of 100 by 100 meters. Therefore, in the coordinate system tied to the village, the southwestern corner of the village has coordinates (0, 0), and northeastern corner - coordinates (N*100, N*100). The highway will cross the village form the west to the east side, cutting through several estates. The government decided to compensate owners of those estates, and to estimate the necessary expenses one should calculate the number of estates crossed by the highway.
Given the village size N and the coordinates of the points where the highway crosses eastern and western borders of the village, you must find the number of estates. You can assume, for the purpose of increasing the financial appeal of the highway project, that the highway is a straight line (i.e. has zero width). If the highway just touches the edge of an estate, it is still considered a crossing.
The highway is a line between points (0, W) and (100*N, E).
Input
In the input, there are three integers, N (1 <= N <= 100), W and E, (0 <= W, E <= 100*N) separated by spaces.
Process to the end of file.
Output
Output must contain a single integer - the number of estates crossed by the highway.
3 150 50
4
Source
Northeastern Europe 2001, Far-Eastern Subregion