RETO2 - TIEMPO JUNTOS grado 10

Today, an exceptional event will happen in the forest - the hedgehog Filya visit his old friend Sonya!

Sonya is an owl and sleeps during the day and awake from minute to minute L1 R1, inclusive. In addition, during the minute she preens k and is not available for Filya.

Filya works hard and plans to visit Sonya minute to minute R2 L2, inclusive.

Calculate the number of minutes they can spend together.

Spanish version

Input

The only line of input contains integers L1, R1, L2, R2 and k (1 ≤ L1, R1, L2, R2, k ≤ 1018, L1 ≤ R1, L2 ≤ R2), providing time slots for Sonya and Filya and the moment of time when Sonya preens.

Output

Print an integer - the total number of minutes that Sonya and Filya can spend together.

Example

Input:
1 10 9 20 1

Output:
2
Input:
1 100 50 200 75

Output:
50

Explanation

In the first example, they can be together during the 9 to 10 minutes.

In the second example, they can be together from 50 to 74 minutes and 76 to 100.


Added by:MaratónAFDM
Date:2016-10-07
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C NCSHARP CSHARP C++ 4.3.2 JAVA JULIA PYTHON PYPY3 PYTHON3

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.