#include <bits/stdc++.h>
using namespace std;
const int MAX = 5e6 + 1111, mod = 998244353;
int main() {
  long long w, h;
  long long w2, h2;
  long long w3, h3;
  cin >> w >> h;
  cin >> w2 >> h2;
  cin >> w3 >> h3;
  while (h) {
    w += h;
    if (h == h2) w -= w2;
    if (h == h3) w -= w3;
    w = max(0LL, w);
    h--;
  }
  cout << w;
}
