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;

public final class Main {
    private FScanner in;
    //    -------------I/O-------------    \\
    private PrintWriter out;

    public static void main(String[] args) {
        new Main().runIO();
    }

    boolean isPrime(int a) {
        if (a == 1) {
            return false;
        }
        for (int i = 2; i * i <= a; i++) {
            if (a % i == 0)
                return false;
        }
        return true;
    }

    //lt a+e1+b
    //rt a+c+tmprt
    //lb b+d+tmplb
    //rb c+d+tmprb

    public void solve() {
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = 1;
        int e1 = 1;
        long result = 0;
        for (e1 = 1; e1 <= n; e1++) {
            int tmprt = b + e1 - c;
            int tmplb = e1 + a - d;
            int tmprb = b + a + e1 - c - d;
            if (tmprt <= n && tmplb <= n && tmprb <= n && tmprt > 0 && tmplb > 0 && tmprb > 0) {
                result+=n;
            }
        }
        out.println(result);
    }

    void run() {
        try {
            in = new FScanner(new File("input.txt"));
            out = new PrintWriter(new BufferedWriter(new FileWriter(new File("output.txt"))));
            solve();
            out.close();
            in.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    void runIO() {
        in = new FScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
        in.close();
    }

    class FScanner {

        private BufferedReader br;
        private StringTokenizer st;

        public FScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException ex) {
                ex.printStackTrace();
            }
        }

        void useString(String s) {
            if (s != null) {
                st = new StringTokenizer(s);
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        void close() {
            try {
                br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}