Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Restoring Painting

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputVasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he was on duty. He doesn't want to be fired, so he has to quickly restore the painting. He remembers some facts about it.

- The painting is a square 3 × 3, each cell contains a single integer from 1 to
*n*, and different cells may contain either different or equal integers. - The sum of integers in each of four squares 2 × 2 is equal to the sum of integers in the top left square 2 × 2.
- Four elements
*a*,*b*,*c*and*d*are known and are located as shown on the picture below.

Help Vasya find out the number of distinct squares the satisfy all the conditions above. Note, that this number may be equal to 0, meaning Vasya remembers something wrong.

Two squares are considered to be different, if there exists a cell that contains two different integers in different squares.

Input

The first line of the input contains five integers *n*, *a*, *b*, *c* and *d* (1 ≤ *n* ≤ 100 000, 1 ≤ *a*, *b*, *c*, *d* ≤ *n*) — maximum possible value of an integer in the cell and four integers that Vasya remembers.

Output

Print one integer — the number of distinct valid squares.

Examples

Input

2 1 1 1 2

Output

2

Input

3 3 1 2 3

Output

6

Note

Below are all the possible paintings for the first sample.

In the second sample, only paintings displayed below satisfy all the rules.

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/21/2019 01:29:57 (f2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|