Pilot Monitor#4205

Pilot Monitor

1 sekunt
256 megabaýt
Örän kyn

In an aircraft cockpit, space is very limited, which makes it challenging to install additional sensors. An engineer has proposed an interesting solution: display the readings from multiple sensors on a single monitor, pairing them in rectangular windows. The placement of the windows on the monitor will be handled by your colleagues, while your task is to determine the minimum required height of a window that can accommodate two graphs.

Each graph is constructed from a set of points: for the first graph, measurements of some quantity Y_i (such as speed, altitude, temperature in the cabin, etc.), taken at times t_i. The measurement times for different quantities may not align, but the first and last value in each graph are always measured at the same moments in time, and the first point is always at time . Points are connected by straight line segments.

On the monitor, you can use two different vertical scales, hence you may shift each graph independently up or down by adding the same number to all its values, to reduce the overall window height. However, after shifting, the graphs must not intersect (they may touch at a finite number of points or partially coincide).

Giriş

The first line contains an integer (2 \leq N \leq 10^5), the number of points in the first graph. The next lines each contain two integers, t_i and Y_i, separated by a space, where 0 \leq t_i \leq 10^6 and -10^4 \leq Y_i \leq 10^4, representing the points of the first graph.

The following line contains an integer (2 \leq M \leq 10^5), the number of points in the second graph. The next lines each contain two integers, t_j and Z_j, separated by a space, where 0 \leq t_j \leq 10^6 and -10^4 \leq Z_j \leq 10^4, representing the points of the second graph.

All graph points are ordered in increasing time. For each quantity, there is at most one value at any given time.

Çykyş

Print a single line containing two numbers separated by a slash "/": the numerator and denominator of the irreducible fraction representing the minimum possible height of the window. If the denominator is , print only the numerator.

Mysallar

1-nji mysal

Loading
Loading