#include <bits/stdc++.h>
struct Snow {
  int weight;
  int height;
};
int main() {
  std::ios::sync_with_stdio(false);
  Snow snowball;
  Snow stone[2];
  std::cin >> snowball.weight;
  std::cin >> snowball.height;
  std::cin >> stone[0].weight;
  std::cin >> stone[0].height;
  std::cin >> stone[1].weight;
  std::cin >> stone[1].height;
  while (snowball.height > 0) {
    snowball.weight += snowball.height;
    for (int i = 0; i < 2; i++) {
      if (snowball.height == stone[i].height) {
        snowball.weight -= stone[i].weight;
        if (snowball.weight < 0) {
          snowball.weight = 0;
        }
      }
    }
    --snowball.height;
  }
  std::cout << snowball.weight;
  return 0;
}
