3384.Inna and Babies

Time Limit: 1s Memory Limit: 256MB

Inna, Dima and Sereja are in one room together. It's cold outside, so Sereja suggested to play a board game called "Babies".

The babies playing board is an infinite plane containing n blue babies and m red ones. Each baby is a segment that grows in time. At time moment t the blue baby (x,y) is a blue segment with ends at points (x-t,y+t), (x+t,y-t). Similarly, at time t the red baby (x,y) is a red segment with ends at points (x+t,y+t), (x-t,y-t) of the plane. Initially, at time t=0 all babies are points on the plane.

The goal of the game is to find the first integer moment of time when the plane contains a rectangle of a non-zero area which sides are fully covered by some babies. A side may be covered by multiple babies. More formally, each point of each side of the rectangle should be covered by at least one baby of any color. At that, you must assume that the babies are closed segments, that is, they contain their endpoints.

You are given the positions of all babies - help Inna and Dima to find the required moment of time.

Input Format(From the terminal/stdin)

The first line of the input contains two integers n and m (1 \le n,m \le 2000).

Next n lines contain the coordinates of the blue babies. The i-th line contains integers xi,yi - a baby's coordinates. Next m lines contain the coordinates of m red babies in the similar form.

All coordinates of the input don't exceed 106 in their absolute value. Note that all babies stand in distinct points.

Output Format(To the terminal/stdout)

In the single line print a single integer - the answer to the problem.

If the rectangle never appears on the plane, print "Poor Sereja!" without the quotes.

Sample Input 1

Copy
2 2
2 2
5 5
3 7
5 1
 · \n
 · \n
 · \n
 · \n
 · \n

Sample Output 1

Copy
3
 \n

Sample Input 2

Copy
3 2
2 2
3 2
6 2
4 2
5 2
 · \n
 · \n
 · \n
 · \n
 · \n
 · \n

Sample Output 2

Copy
1
 \n

Submit

请先 登录

© 2025 FAQs