ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Ural Championship 2005 Round I

About     Problems     Submit solution     Judge status     Standings
Contest is over

D. Pictura ex Machina

Time limit: 1.0 second
Memory limit: 64 MB
Don't you want to be a millionair? It is so simple! You only need to automate some prevalent handwork, and then you save enough money to buy so long wanted beautiful red Ferrari.
For example, why not to automate a process of dime novels? Or why not to automate a process of writing songs for pop-stars? No! It is too simple for real programmer, it is below you! So in this task you will need to automate something spiritual: the process of paintings creation! Just think about it: home computer will be able to create beautiful landscapes, artful still lifes and even delicate self-portraits!
Frankly speaking, painting algorithm is already developed and implemented by your colleague, great programmer Mr.Petrov. His algorithm makes a description of brushstrokes, so it is enough to load this description into plotter, and in a couple of hours the picture will be ready.
Meanwhile a frame for the picture may be prepared. But this is where Mr. Petrov fails: he can not calculate size of the picture given the brushstrokes description produced by his algorithm…
It could be just trivial if each brushstroke was a line segment. But the major innovation of Petrov's algorithm is that his rushstrokes has a form of an angle. To make this kind of brushstroke one needs to draw (by a brush, or a plotter) a line segment of X millimeters length in one direction, then turn 90 degrees clockwise and draw another line segment of X millimeters length. This is what innovative Petrov's brushstroke looks like.

Input

Input contains N (0 ≤ N ≤ 100000) lines of numbers. Each line describes single brushstroke. Description consists of four integers: coordinates of the start and coordinates of the end points of the brushstroke. All integers do not exceed 10000 in absolute value.

Output

Output should contain 2 numbers: the width and the height of the smallest frame for the picture, produced by brushstrokes description given in input. Numbers must be separated with single space. And they should have a precision of 4 decimal digits.
Notice, that picture must not be rotated, even if it allows to fit the picture into the frame of smaller size. Your task is not to save materials, from which the frame is made. You just have to prepare suitable frame for the picture. Also make sure that all parts of each brushstroke are inside the frame.

Sample

inputoutput
0 0 1 1
1 1 2 0
2 0 0 0
2 0 3 0
3.0000 2.0000
Problem Author: Pavel Egorov
Problem Source: IX Urals Programming Contest. Yekaterinburg, April 19-24, 2005
To submit the solution for this problem go to the Problem set: 1373. Pictura ex Machina