At one of the train stations in a large city, there are ticket counters, each following a fixed daily schedule without breaks.
Your task is to calculate the total duration of time during the day when all the counters are open at the same time.
The input begins with an integer (0 \le n \le 10000), representing the number of ticket counters.
Each of the next lines contains integers. The first three integers specify the opening time of a counter in hours, minutes, and seconds (hours range from to , while minutes and seconds range from to ). The next three integers specify the closing time in the same format. All integers are separated by spaces.
The opening time indicates that the counter is operational from that exact second, while the closing time indicates that the counter stops operating at that second. For instance, a counter open from hours minutes seconds to hours minutes seconds is operational for seconds each day.
If the opening and closing times are identical, the counter operates continuously for 24 hours. If the opening time is later than the closing time, the counter operates overnight, starting before midnight and ending the next day.
Output a single integer — the total number of seconds during the day when all counters are simultaneously operational.
Example 1