#include <bits/stdc++.h>
using namespace std;
int main() {
  int w, h;
  cin >> w >> h;
  int w_r1, h_r1;
  int w_r2, h_r2;
  cin >> w_r1 >> h_r1 >> w_r2 >> h_r2;
  int height[h + 1];
  for (int i = h; i >= 0; i--) {
    w += i;
    if (i == h_r1) w -= w_r1;
    if (i == h_r2) w -= w_r2;
    if (w < 0) w = 0;
  }
  cout << w;
  return 0;
}
