Farmer Ran's View (view.X) In order to escape the boring scenery next to his old farm, Farmer Ran has decided to move away from the Wisconsin plains to a new location near the mountains. From this new location, if he looks around at the view in all 360 degrees around him, he sees mountains in some directions and no mountains in other directions. He wants to know what fraction of his view is made up of mountains. A total of N (1 <= N <= 1000) mountain ranges surround FR's new location. When he looks at any one of them, it appears as a contiguous range. Think of the view as a circle divided up into 360 little arcs, each of them corresponding to 1 degree. Each of these little arcs is subdivided into 60 arc-minutes and each of these is further divided into 60 arc-seconds. In order to precisely record the range of his view occupied by each mountain range, FJ writes down the starting and ending angle of each range. For example: Range #34 starts at 45 degrees, 2 minutes, 59 seconds, and ends at 120 degrees, 10 minutes, and 0 seconds. Of course, this description is somewhat ambiguous since it does not specify whether the range curves clockwise or counterclockwise around his field of view. However, FR notices that no mountain range occupies 180 degrees or more of his field of view, thereby removing any ambiguity. The sample range above therefore occupies a total of 270,421 arc seconds. The angles occupied by different mountain ranges may overlap, and FR wishes to compute the total number of arc seconds in his field of view that are occupied by mountains. PROBLEM NAME: view.X INPUT FORMAT: * Line 1: A single integer, N * Lines 2..N+1: Each line describes a mountain range's arc and contains 6 space-separated integers. The first three integers correspond to the (degree, minute, second) of the starting angle of the range and the last three correspond to the (degree, minute, second) of the ending angle of the range. SAMPLE INPUT: 3 45 2 59 60 30 30 50 10 2 120 10 0 355 0 0 356 0 0 OUTPUT FORMAT: * Line 1: A single integer giving the total number of arc seconds in FR's view that are occupied by mountains. SAMPLE OUTPUT (file fjview.out): 274021 OUTPUT DETAILS: The first two ranges overlap slightly and cover a combined angle of 270421 arc seconds. The third range covers 3600 arc seconds.