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>
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.text.*;

/**
 *
 * @author zulkan
 */
public class cf675b {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    
    public static String getString() {
        try {
            return br.readLine();
        } catch (Exception e) {
        }
        return "";
    }
    
    public static Integer getInt() {
        try {
            return Integer.parseInt(br.readLine());
        } catch (Exception e) {
        }
        return 0;
    }
    
    public static Integer[] getIntArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Integer temp2[] = new Integer[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Integer.parseInt(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }
    
    public static Long[] getLongArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            Long temp2[] = new Long[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = Long.parseLong(temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }
    
    public static String[] getStringArr() {
        try {
            StringTokenizer temp = new StringTokenizer(br.readLine());
            int n = temp.countTokens();
            String temp2[] = new String[n];
            for (int i = 0; i < n; i++) {
                temp2[i] = (temp.nextToken());
            }
            return temp2;
        } catch (Exception e) {
        }
        return null;
    }
    
    public static void print(Object a) {
        out.print(a);
    }
    
    public static void println(Object a) {
        out.println(a);
    }
    
    public static void printf(String s, Object... a) {
        out.printf(s, a);
    }
    
    public static int nextInt() {
        return sc.nextInt();
    }
    
    public static double nextDouble() {
        return sc.nextDouble();
    }
    
    public static void main(String[] ar) {
        cf675b c = new cf675b ();
        c.solve();
        out.flush();
    }
    public void solve(){
        Integer xx[] = getIntArr();
        
        int n = xx[0], a = xx[1], b = xx[2], c = xx[3], d = xx[4];
        
        long out = 0;
        
        for(int mid = 1;mid<=n;mid++) {
            int sumkirtas = a + b + mid;
            int sumkantas = a + c + mid;
            int sumkirwah = b + d + mid;
            int sumkanwah = c + d + mid;
            
            Integer ar[] = new Integer[] {sumkirtas, sumkantas, sumkirwah, sumkanwah};
            
            Arrays.sort(ar);
            
            if(ar[3] - ar[0] > (n-1)) {
                continue;
            }
            //println(mid+" "+Arrays.asList(ar));
            out+= (n) - (ar[3]- ar[0]);
            
        }
        println(out);
    }

}
