eolymp
bolt
Try our new interface for solving problems
Problems

Programming olympiad

Programming olympiad

Time limit 1 second
Memory limit 128 MiB

There are n participants arrived to ACM competition. As a result of the survey, the jury found that a participants code in C, b in Python, c in Pascal, x simultaneously know C and Python, y - Python and Pascal, z - C and Pascal. Given the values n, a, b, c, x, y, z, find the number of participants who program in three programming languages.

Input data

The first line contains seven integers n, a, b, c, x, y, z, the values do not exceed 100.

Output data

Print the number of participants who write the code in three programming languages.

Examples

Input example #1
100 40 50 60 15 20 25
Output example #1
10