Module: (C++) Workshop - 1 "Sofia the first". Linear Algorithms

Problem

9
/11

*Baker king

Problem

King wants to become a baker and lead a simple lifestyle.
The royal kitchen is covered with a kitchen apron, which is divided into squares with side A see. King wants to hang a picture of his family on the apron. He knows the point at which the lower left corner of the painting is in contact, as well as the width and height of the painting itself. And then he wanted to know the number of squares that would be partially or completely covered by the picture.

Input format
The first line contains the number A - the side of one square of the kitchen apron.
The second and third lines - the numbers X and Y - are the coordinates of the lower left corner of the picture.
The fourth and fifth lines - the numbers W and H - the width and height of the picture.
The axis OX is directed to the right, the axis OY is directed up.
The lower left corner of one of the squares of the kitchen apron is at the origin. All numbers are integers not exceeding 2 × 10^{9}, numbers A, W, H are positive, numbers X and Y are positive or equal to 0.

Output format
Output one number - the number of tiles completely or partially covered by the picture.
A square is considered a closed picture if the intersection of the picture and the square has a non-zero area, that is, touching the picture and the square is not considered overlapping.

Example

№

Input

Output

1

10
15
5
35
20

12

Description

Side of the square (side of the cell in the figure) A = 10.
The lower left corner of the picture has coordinates (15, 5), the picture has a width of 35 cm and a height of 20 cm.
The painting completely or partially covers 12 squares