Hard choice

Given prepared and requested counts for chicken, beef, and pasta, count passengers whose requested meal is unavailable.

Easy1MathImplementationNo attempts yetTime limit1sMemory limit1024 MB

Problem

On long flights an airline serves hot meals. A flight attendant usually pushes a cart of meals down the aisle, and the moment the cart reaches your row you are asked: "Chicken, beef, or pasta?" You know the options, but you have only a few seconds to pick, and you cannot tell what your choice looks like because your neighbor has not opened the wrap yet.

The attendant on this flight changed the order of things. First she asks every passenger which meal they want, and then she checks whether the number of meals prepared for each option is enough.

For example, suppose the prepared counts for chicken, beef and pasta are 80, 20 and 40, while the counts requested by passengers are 45, 23 and 48. Eleven passengers then do not get the meal they chose, because three passengers who wanted beef and eight who wanted pasta cannot be served.

Given the prepared count and the requested count for each option, find how many passengers do not get the meal they chose. A passenger is satisfied only by the option they picked, so being handed a leftover meal of another type does not count.

Input

The first line contains three integers CaC_a, BaB_a and PaP_a (0Ca,Ba,Pa1000 \le C_a, B_a, P_a \le 100), the number of meals prepared for chicken, beef and pasta.

The second line contains three integers CrC_r, BrB_r and PrP_r (0Cr,Br,Pr1000 \le C_r, B_r, P_r \le 100), the number of passengers who requested chicken, beef and pasta.

Output

Print one line with a single integer, the number of passengers who do not get the meal they chose.