0078. Lines

Имя входного файла: lines.in
Имя выходного файла: lines.out
Ограничение по времени: 500 ms
Ограничение по памяти: 16 megabytes

You are given N lines in space.

Find such point that the sum of squares of distances from it to the given lines is minimal possible.

Input file

The first line of the input file contains one integer number N (1 ≤ N ≤ 1000). The following N lines contain 6 real numbers each: (x1, y1, z1) and (x2, y2, z2) – two different points lying on the corresponding line. All coordinates do not exceed 103 by their absolute value.

Output file

Output three real numbers – coordinates of the point found. If there are several such points, output any one. Print all numbers with at least six digits after the decimal point.

Examples:

lines.inlines.out
2 0 0 0 1 0 0 0 0 1 0 1 10.000000 0.000000 0.500000


Источник: Petrozavodsk Winter 2003. St. Petersburg Contest II, Thursday, February 06

Обсудить       Отправить решение



Версия для печати