#000257

Berba

How many ways can the following inequality be satisfied if the question marks are replaced by positive integers?

Image: dsadsa


InputThe first line contains three integers B, [] and D (1 ≤ B, C, D ≤ 1000). The second line contains two integers A1 and A2 (1 ≤ A1, A2 ≤ 1000). The third line contains two integers E1 and E2 (1 ≤ E1, E2 ≤ 1000).

OutputOutput the number of ways to satisfy the inequality.

Input:
[c]3 2 4
2 7
4 5

Output:
1


Input :
5 5 5
999 1
1000 1

Output:
4


Input:
1 9 7
14 5
10 3

Output:
3

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.