#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int test = 1;     for (; test > 0; --test) {       long long int n, a, b, c, d, c1 = 1, c2, c3, c4;       cin >> n >> a >> b >> c >> d;       c2 = c1 + b - c;       c3 = c2 + a - d;       c4 = c3 + c - b;       long long int m = 1 - min(min(c1, c2), min(c3, c4)),                     m1 = max(max(c1, c2), max(c3, c4));       if (m1 + abs(m) > n)         cout << 0 << endl;       else         cout << (n - (m1 + abs(m)) + 1) * n << endl;     }     return (0);   }   