#include <bits/stdc++.h>
using namespace std;
inline int FSGN(double x) {
  if (x > 1e-8) return 1;
  if (x >= -1e-8) return 0;
  return -1;
}
struct point {
  double x, y;
  point() {}
  point(double _x, double _y) : x(_x), y(_y) {}
  point operator+(const point &p) const { return point(x + p.x, y + p.y); }
  point operator-(const point &p) const { return point(x - p.x, y - p.y); }
  point operator*(const double &p) const { return point(x * p, y * p); }
  double operator*(const point &p) const { return x * p.x + y * p.y; }
  point operator/(const double &p) const { return point(x / p, y / p); }
  double operator^(const point &p) const { return x * p.y - y * p.x; }
  bool operator==(const point &p) const {
    return fabs(x - p.x) < 1e-8 && fabs(y - p.y) < 1e-8;
  }
  bool operator<(const point &p) const {
    if (y == p.y) return x - p.x;
    return y - p.y;
  }
  double getRatio(point &a, point &b) {
    if (fabs(b.x - a.x) < 1e-8) return (y - a.y) / (b.y - a.y);
    return (x - a.x) / (b.x - a.x);
  }
};
double xmult(point p1, point p2, point p0) {
  return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y);
}
double dmult(point p1, point p2, point p0) {
  return (p1.x - p0.x) * (p2.x - p0.x) + (p1.y - p0.y) * (p2.y - p0.y);
}
double distance(point p1, point p2) {
  return sqrt(((p1.x - p2.x) * (p1.x - p2.x)) +
              ((p1.y - p2.y) * (p1.y - p2.y)));
}
struct Polygon2D {
  int n, bn;
  point p[10], bag[10];
  double getArea() {
    double area = 0;
    for (int i = 2; i < bn; i++) {
      area += xmult(bag[i], bag[i - 1], bag[0]);
    }
    return fabs(area / 2.0);
  }
  void make_bag() {
    int i, j;
    sort(p, p + n);
    bag[0] = p[0];
    int len = 1;
    for (int i = 1; i < n; i++) {
      while (len >= 2 && xmult(bag[len - 2], bag[len - 1], p[i]) <= 0) len--;
      bag[len++] = p[i];
    }
    j = len + 1;
    for (i = n - 2; i >= 0; i--) {
      while (len >= j && xmult(bag[len - 2], bag[len - 1], p[i]) <= 0) len--;
      bag[len++] = p[i];
    }
    len--;
    bn = len;
  }
};
struct PolygonSet2D {
  int n;
  Polygon2D pSet[505];
  pair<double, int> buf[10 * 505];
  double getCombination() {
    for (int i = 0; i < n; i++) {
      pSet[i].make_bag();
    }
    if (n == 1) {
      return pSet[0].getArea();
    }
    int cnt, c1, c2;
    double s1, s2, ret = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < pSet[i].bn; j++) {
        cnt = 0;
        buf[cnt++] = pair<double, int>(0.0, 0);
        buf[cnt++] = pair<double, int>(1.0, 0);
        for (int k = 0; k < n; k++) {
          if (i == k) continue;
          for (int q = 0; q < pSet[k].bn; q++) {
            c1 = FSGN((pSet[i].bag[j + 1] - pSet[i].bag[j]) ^
                      (pSet[k].bag[q] - pSet[i].bag[j]));
            c2 = FSGN((pSet[i].bag[j + 1] - pSet[i].bag[j]) ^
                      (pSet[k].bag[q + 1] - pSet[i].bag[j]));
            if (!c1 && !c2) {
              if (((pSet[i].bag[j + 1] - pSet[i].bag[j]) *
                   (pSet[k].bag[q + 1] - pSet[k].bag[q])) > 0 &&
                  i > k) {
                buf[cnt++] = pair<double, int>(
                    pSet[k].bag[q].getRatio(pSet[i].bag[j], pSet[i].bag[j + 1]),
                    1);
                buf[cnt++] =
                    pair<double, int>(pSet[k].bag[q + 1].getRatio(
                                          pSet[i].bag[j], pSet[i].bag[j + 1]),
                                      -1);
              }
            } else {
              s1 = ((pSet[k].bag[q + 1] - pSet[k].bag[q]) ^
                    (pSet[i].bag[j] - pSet[k].bag[q]));
              s2 = ((pSet[k].bag[q + 1] - pSet[k].bag[q]) ^
                    (pSet[i].bag[j + 1] - pSet[k].bag[q]));
            }
            if (c1 >= 0 && c2 < 0)
              buf[cnt++] = make_pair(s1 / (s1 - s2), 1);
            else if (c1 < 0 && c2 >= 0)
              buf[cnt++] = make_pair(s1 / (s1 - s2), -1);
          }
        }
        sort(buf, buf + cnt);
        double pre = min(max(buf[0].first, 0.0), 1.0), now;
        double sum = 0;
        double cov = buf[0].second;
        for (int k = 1; k < cnt; k++) {
          now = min(max(buf[k].first, 0.0), 1.0);
          if (!cov) sum += now - pre;
          cov += buf[k].second;
          pre = now;
        }
        ret += (pSet[i].bag[j] ^ pSet[i].bag[j + 1]) * sum;
      }
    }
    return fabs(ret / 2.0);
  }
} ch;
int main() {
  int nt = 4;
  double ret;
  while (~scanf("%d", &ch.n)) {
    ret = 0;
    for (int i = 0; i < ch.n; ++i) {
      ch.pSet[i].n = nt;
      for (int j = 0; j < nt; ++j) {
        scanf("%lf%lf", &ch.pSet[i].p[j].x, &ch.pSet[i].p[j].y);
      }
      ch.pSet[i].make_bag();
      ret += ch.pSet[i].getArea();
    }
    ret /= ch.getCombination();
    printf("%.9lf\n", ret);
  }
  return 0;
}
