I. Agronomist
time limit per test
1.5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

More than anything, Professor R. loves working in the garden and even wants to retrain as an agronomist. Since gardening is a true passion of his life, and he just loves mathematics, he tries different ways to plant tomatoes.

The Professor's garden is a rectangle with its bottom-left corner at the point $$$(x, y)$$$, width $$$w$$$ (along the $$$Ox$$$ axis) and height $$$h$$$ (along the $$$Oy$$$ axis) and sides of the rectangle are parallel to the coordinate axes. The Professor can plant tomatoes only at points with integer coordinates in his garden (including the garden's boundary). Initially, he starts at the point with coordinates $$$(0, 0)$$$ and from there he can move to any point with integer coordinates located at a distance of $$$\sqrt{n}$$$, where $$$n$$$ is a number whose prime factorization contains $$$2$$$ to an odd power. From there, he can again move to another point with integer coordinates located at a distance of $$$\sqrt{n}$$$, and so on, so the Professor moves along the plane and plants tomatoes.

The Professor needs to prepare the seedlings for planting in advance; he wants to plant as many tomatoes as possible in his garden, and at the same time so that, after planting in the way described above, no seedlings remain unused — in other words, the number of seedlings must be equal to the number of points with integer coordinates in the garden that he can reach by stepping a distance of $$$\sqrt{n}$$$.

The Professor is on vacation and has not been doing calculations for a long time. Help him write a program that determines how many seedlings need to be prepared in order to plant as many tomato seedlings as possible at points with integer coordinates that can be reached from $$$(0, 0)$$$ by stepping on $$$\sqrt{n}$$$.

Input

The input data contains $$$5$$$ integers: $$$n$$$, $$$x$$$, $$$y$$$, $$$w$$$, $$$h$$$, where $$$n$$$ ($$$2 \le n \le 10^{12}$$$) — the square of the Professor's step length, where $$$n$$$ is such that its factorization contains $$$2$$$ to an odd power, $$$x$$$, $$$y$$$ ($$$-10^9 \le x, y \le 10^9$$$) — coordinates of the lower-left corner of the garden, $$$w$$$, $$$h$$$ ($$$1 \le w, h \le 5 \cdot 10^5$$$) — the width and height of the vegetable garden (horizontal and vertical), respectively.

Output

Print a single number — the total number of tomato seedlings that need to be prepared by Kadyrbechu (that's Professor R.'s name) for planting.

Examples
Input
8 0 0 4 4
Output
5
Input
8 -1 -1 5 5
Output
5
Input
10 0 0 30 30
Output
481
Input
10 -10 -10 100 100
Output
5101