Vasya 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. 

<image>

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. <image> <image>

In the second sample, only paintings displayed below satisfy all the rules. <image> <image> <image> <image> <image> <image>
import java.io.*;
import java.util.StringTokenizer;

/**
 * @author zyulyaev
 * @since 11.06.16
 */
public class B {
    private final FastReader in;
    private final PrintWriter out;

    public B(FastReader in, PrintWriter out) {
        this.in = in;
        this.out = out;
    }

    public void run() {
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();

        long cnt = 0;
        for (int a1 = 1; a1 <= n; ++a1) {
            long sum = a1 + a + b;

            long a2 = sum - a - c;
            long a3 = sum - c - d;
            long a4 = sum - b - d;

            if (a2 >= 1 && a2 <= n && a3 >= 1 && a3 <= n && a4 >= 1 && a4 <= n)
                cnt ++;
        }

        out.println(cnt * n);
    }
    
    public static void main(String[] args) throws IOException {
        try (FastReader in = new FastReader(System.in);
             PrintWriter out = new PrintWriter(System.out)) {
            new B(in, out).run();
        }
    }

    private static class FastReader implements Closeable {
        private final BufferedReader reader;
        private StringTokenizer tok;

        public FastReader(InputStream is) {
            this.reader = new BufferedReader(new InputStreamReader(is));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException ex) {
                return null;
            }
        }

        public String next() {
            if (tok == null || !tok.hasMoreTokens())
                tok = new StringTokenizer(nextLine());
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        @Override
        public void close() throws IOException {
            reader.close();
        }
    }
}
