Bland Ice is one of the strongest table football player, and he is going around the world playing tournaments to gain the most ranking points possible.

The world is made up of cities, connected by bidirectional roads. Moving along a single road always take one day, and it is possible to move from any city to any other using the roads. Ice is currently in city .
Ice knows that there will be tournaments in the upcoming days, the -th of which is in city and days in the future. Note that Ice can take part in a tournament on the very same day he arrives in its city.
Task
Ice wants to take part in as many tournaments as possible, however he is too busy practicing his "Chinese shot" to plan which tournaments to take part in and he is therefore asking for your help!
What's the maximum number of tournaments he can take part in?
Input data
The input file consists of lines, containing:
- Line : two integers and .
- Line (): two integers and .
- Line (): two integers and .
Output data
The output file must contain a single line containing the answer to the problem.
Constraints and clarifications
- .
- .
- for each .
- for each .
- for each .
- for each .
- Each pair of city is connected by some roads.
- There are no two tournaments on the same day in the same city.
| # | Score | Constraints |
|---|---|---|
| 1 | 0 | Examples |
| 2 | 15 | |
| 3 | 15 | , |
| 4 | 20 | |
| 5 | 10 | and for each |
| 6 | 10 | and for each |
| 7 | 30 | No additional restrictions |
Example
stdin
5 5
0 1
4 1
2 0
3 1
4 0
4 5
2 2
2 4
1 0
stdout
2
Explanation
The figure shows the first sample case}. In this case, Bland Ice can move to city and remain there forever, taking part in tournaments.
It can be shows that in no way Ice can take part in tournaments.
