Long long ago in a far far away land, there were two great cities and The Great Caravan Road between them. Many robber gangs "worked" on that road.
By an old custom, the
You are hired to compute the maximal possible length of an interval that each gang would control after redistribution.
Input
The first line contains
Output
Output the maximal possible length of an interval in miles as an irreducible fraction
Sample Input
3
2 6
1 4
8 12
Sample Output
5/2
Sample Explanation
In the above example, one possible set of new intervals that each gang would control after redistribution is given below.
- The first gang would control an interval between
and miles which has length of and is a subinterval of its original . - The second gang would control an interval between
and miles which has length of and is a subinterval of its original . - The third gang would control an interval between
and miles which has length of and is a subinterval of its original .
Comments
The intervals are such that no two gangs have the same start or end point, which means the intervals are distinct for each gang. However, the intervals may overlap partially. That is, part of one gang's interval may lie within the bounds of another's, which has led to conflicts.
The statement "no two distinct i, j....." means that you won't find a situation where one gang's interval is completely within the bounds of another's. But it doesn't rule out partial overlaps.
Note: ^^JUST A SELF REMINDER to avoid reading the instructions every time
If there were no partial overlaps in the input then there would be no need for redistribution.