Problem: The Galaxy contains n planets, there are many different living creatures inhabiting each planet. And each creature can get into troubles! Space rescuers know it perfectly well and they are always ready to help anyone who really needs help. All you need to do is call for them. 

Now the space rescuers plan to build the largest in the history of the Galaxy rescue station; however, the rescue station's location is yet to be determined. As some cases are real emergencies, the rescuers want to find such a point in the Galaxy from which it would be possible to get to the remotest planet in the minimum possible time. In other words, the rescuers need such point in the space that the distance between it and the planet remotest from it was minimal (if we compare this point with all other possible points in the space). Unfortunately, the rescuers can't sole this problem.

As the planets are quite remote from each other, they can be considered as points in Euclidean three-dimensional space. The distance between points (xi, yi, zi) and (xj, yj, zj) can be calculated by the formula <image>. The rescue station can be positioned in any point in the space. It can also coincide with some planet. 

Galaxy is in danger! Save the space rescuers and find the required point for them.

Input

The first line of the input file contains integer n — the number of planets (1 ≤ N ≤ 100). Each of the following n lines contains information about the planets. The i-th line contains three integers xi, yi, zi — the coordinates of the i-th planet ( - 104 ≤ xi, yi, zi ≤ 104, 1 ≤ i ≤ n). No two planets coincide.

Output

Print on the first line of the output file three space-separated real numbers x0, y0, z0 — the coordinates for the future base. If there are several solutions, you are allowed to print any of them. The answer will be accepted if the distance from this point to the remotest planet will differ from the juries' variant in no more than 10 - 6 in absolute or relative value.

Examples

Input

5
5 0 0
-5 0 0
0 3 4
4 -3 0
2 2 -2


Output

0.000 0.000 0.000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int MaxN = 128, NA = -1, MaxC = 0x3F3F3F3F;
const double eps = 1E-9;
double x[MaxN], y[MaxN], z[MaxN];
int xp[MaxN], yp[MaxN], zp[MaxN];
inline double rho2(double x1, double y1, double z1, double x2, double y2,
                   double z2) {
  return ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)) +
         ((z2 - z1) * (z2 - z1));
}
inline double rho(double x1, double y1, double z1, double x2, double y2,
                  double z2) {
  return sqrt(rho2(x1, y1, z1, x2, y2, z2));
}
inline double det3(double a11, double a12, double a13, double a21, double a22,
                   double a23, double a31, double a32, double a33) {
  return a11 * (a22 * a33 - a23 * a32) - a12 * (a21 * a33 - a23 * a31) +
         a13 * (a21 * a32 - a22 * a31);
}
inline double det4(double a11, double a12, double a13, double a14, double a21,
                   double a22, double a23, double a24, double a31, double a32,
                   double a33, double a34, double a41, double a42, double a43,
                   double a44) {
  return a11 * det3(a22, a23, a24, a32, a33, a34, a42, a43, a44) -
         a12 * det3(a21, a23, a24, a31, a33, a34, a41, a43, a44) +
         a13 * det3(a21, a22, a24, a31, a32, a34, a41, a42, a44) -
         a14 * det3(a21, a22, a23, a31, a32, a33, a41, a42, a43);
}
int main(void) {
  int i, j, k, l, m, n;
  double cur, res;
  double a, b, c, d, x1, y1, z1, x0, y0, z0;
  while (scanf(" %d", &n) != EOF) {
    for (i = 0; i < n; i++) scanf(" %lf %lf %lf", &x[i], &y[i], &z[i]);
    res = MaxC * (double)MaxC;
    x1 = y1 = z1 = NA;
    for (i = 0; i < n; i++) {
      x0 = (x[i]) / 1.0;
      y0 = (y[i]) / 1.0;
      z0 = (z[i]) / 1.0;
      cur = 0;
      m = n;
      switch (m % 7) {
        case 0:
          while (m > 0) {
            m--;
            cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
            case 7:
              m--;
              cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
            case 6:
              m--;
              cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
            case 5:
              m--;
              cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
            case 4:
              m--;
              cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
            case 3:
              m--;
              cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
            case 2:
              m--;
              cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
            case 1:
              m--;
              cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
          }
      }
      if (res > cur) {
        res = cur;
        x1 = x0;
        y1 = y0;
        z1 = z0;
      };
      for (j = i + 1; j < n; j++) {
        x0 = (x[i] + x[j]) / 2.0;
        y0 = (y[i] + y[j]) / 2.0;
        z0 = (z[i] + z[j]) / 2.0;
        cur = 0;
        m = n;
        switch (m % 7) {
          case 0:
            while (m > 0) {
              m--;
              cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
              case 7:
                m--;
                cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
              case 6:
                m--;
                cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
              case 5:
                m--;
                cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
              case 4:
                m--;
                cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
              case 3:
                m--;
                cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
              case 2:
                m--;
                cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
              case 1:
                m--;
                cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
            }
        }
        if (res > cur) {
          res = cur;
          x1 = x0;
          y1 = y0;
          z1 = z0;
        };
        for (k = j + 1; k < n; k++) {
          a = rho2(x[j], y[j], z[j], x[k], y[k], z[k]);
          b = rho2(x[i], y[i], z[i], x[k], y[k], z[k]);
          c = rho2(x[i], y[i], z[i], x[j], y[j], z[j]);
          d = 2.0 * (a * b + a * c + b * c) - a * a - b * b - c * c;
          if (fabs(d) < eps * (fabs(x[i]) + fabs(x[j]) + fabs(x[k]) +
                               fabs(y[i]) + fabs(y[j]) + fabs(y[k]) +
                               fabs(z[i]) + fabs(z[j]) + fabs(z[k])))
            continue;
          d = 1.0 / d;
          x0 = (x[i] * a * (b + c - a) + x[j] * b * (c + a - b) +
                x[k] * c * (a + b - c)) *
               d;
          y0 = (y[i] * a * (b + c - a) + y[j] * b * (c + a - b) +
                y[k] * c * (a + b - c)) *
               d;
          z0 = (z[i] * a * (b + c - a) + z[j] * b * (c + a - b) +
                z[k] * c * (a + b - c)) *
               d;
          cur = 0;
          m = n;
          switch (m % 7) {
            case 0:
              while (m > 0) {
                m--;
                cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                case 7:
                  m--;
                  cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                case 6:
                  m--;
                  cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                case 5:
                  m--;
                  cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                case 4:
                  m--;
                  cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                case 3:
                  m--;
                  cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                case 2:
                  m--;
                  cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                case 1:
                  m--;
                  cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
              }
          }
          if (res > cur) {
            res = cur;
            x1 = x0;
            y1 = y0;
            z1 = z0;
          };
          for (l = k + 1; l < n; l++) {
            a = det4(x[i], y[i], z[i], 1, x[j], y[j], z[j], 1, x[k], y[k], z[k],
                     1, x[l], y[l], z[l], 1);
            if (fabs(a) <
                eps * (fabs(x[i]) + fabs(x[j]) + fabs(x[k]) + fabs(y[i]) +
                       fabs(y[j]) + fabs(y[k]) + fabs(z[i]) + fabs(z[j]) +
                       fabs(z[k]) + fabs(x[l]) + fabs(y[l]) + fabs(z[l])))
              continue;
            a = 0.5 / a;
            x0 =
                +det4(((x[i]) * (x[i])) + ((y[i]) * (y[i])) + ((z[i]) * (z[i])),
                      y[i], z[i], 1,
                      ((x[j]) * (x[j])) + ((y[j]) * (y[j])) + ((z[j]) * (z[j])),
                      y[j], z[j], 1,
                      ((x[k]) * (x[k])) + ((y[k]) * (y[k])) + ((z[k]) * (z[k])),
                      y[k], z[k], 1,
                      ((x[l]) * (x[l])) + ((y[l]) * (y[l])) + ((z[l]) * (z[l])),
                      y[l], z[l], 1) *
                a;
            y0 =
                -det4(((x[i]) * (x[i])) + ((y[i]) * (y[i])) + ((z[i]) * (z[i])),
                      x[i], z[i], 1,
                      ((x[j]) * (x[j])) + ((y[j]) * (y[j])) + ((z[j]) * (z[j])),
                      x[j], z[j], 1,
                      ((x[k]) * (x[k])) + ((y[k]) * (y[k])) + ((z[k]) * (z[k])),
                      x[k], z[k], 1,
                      ((x[l]) * (x[l])) + ((y[l]) * (y[l])) + ((z[l]) * (z[l])),
                      x[l], z[l], 1) *
                a;
            z0 =
                +det4(((x[i]) * (x[i])) + ((y[i]) * (y[i])) + ((z[i]) * (z[i])),
                      x[i], y[i], 1,
                      ((x[j]) * (x[j])) + ((y[j]) * (y[j])) + ((z[j]) * (z[j])),
                      x[j], y[j], 1,
                      ((x[k]) * (x[k])) + ((y[k]) * (y[k])) + ((z[k]) * (z[k])),
                      x[k], y[k], 1,
                      ((x[l]) * (x[l])) + ((y[l]) * (y[l])) + ((z[l]) * (z[l])),
                      x[l], y[l], 1) *
                a;
            cur = 0;
            m = n;
            switch (m % 7) {
              case 0:
                while (m > 0) {
                  m--;
                  cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                  case 7:
                    m--;
                    cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                  case 6:
                    m--;
                    cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                  case 5:
                    m--;
                    cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                  case 4:
                    m--;
                    cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                  case 3:
                    m--;
                    cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                  case 2:
                    m--;
                    cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                  case 1:
                    m--;
                    cur = max(cur, rho2(x0, y0, z0, x[m], y[m], z[m]));
                }
            }
            if (res > cur) {
              res = cur;
              x1 = x0;
              y1 = y0;
              z1 = z0;
            };
          }
        }
      }
    }
    printf("%.10lf %.10lf %.10lf\n", x1, y1, z1);
  }
  return 0;
}