#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;
  }
  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;
  int nr;
  point *v;
  point *vr;
  Polygon2D() {
    v = new point[10];
    vr = new point[10];
  }
  ~Polygon2D() {
    delete[] v;
    delete[] vr;
  }
  double getArea() {
    double ret = 0;
    for (int i = 1; i < n - 1; ++i) {
      ret += (v[i] - v[0]) ^ (v[i + 1] - v[0]);
    }
    return fabs(ret) / 2;
  }
  void setOrder() {
    int i, j, di, st, dt;
    for (i = 0; i < n - 2 && fabs((v[i + 1] - v[i]) ^ (v[i + 2] - v[i])) < 1e-8;
         ++i)
      ;
    di = ((v[i + 1] - v[i]) ^ (v[i + 2] - v[i])) > 1e-8 ? 1 : -1;
    for (i = di > 0 ? 0 : n - 1, j = 0; i < n && i >= 0; i += di, j++) {
      vr[j] = v[i];
    }
    vr[nr = j] = vr[0];
  }
};
struct PolygonSet2D {
  int tot;
  Polygon2D *ps;
  pair<double, int> *buf;
  PolygonSet2D() {
    buf = new pair<double, int>[10 * 505];
    ps = new Polygon2D[505];
  }
  ~PolygonSet2D() {
    delete[] buf;
    delete[] ps;
  }
  double getCombination() {
    if (tot == 1) return ps[0].getArea();
    for (int i = 0; i < tot; ++i) {
      ps[i].setOrder();
    }
    int cnt, c1, c2;
    double s1, s2, ret = 0;
    for (int i = 0; i < tot; i++) {
      for (int ii = 0; ii < ps[i].nr; ii++) {
        cnt = 0;
        buf[cnt++] = make_pair(0.0, 0);
        buf[cnt++] = make_pair(1.0, 0);
        for (int j = 0; j < tot; j++) {
          if (i == j) continue;
          for (int jj = 0; jj < ps[j].nr; jj++) {
            c1 = FSGN((ps[i].vr[ii + 1] - ps[i].vr[ii]) ^
                      (ps[j].vr[jj] - ps[i].vr[ii]));
            c2 = FSGN((ps[i].vr[ii + 1] - ps[i].vr[ii]) ^
                      (ps[j].vr[jj + 1] - ps[i].vr[ii]));
            if (!c1 && !c2) {
              if (((ps[i].vr[ii + 1] - ps[i].vr[ii]) *
                   (ps[j].vr[jj + 1] - ps[j].vr[jj])) > 0 &&
                  i > j) {
                buf[cnt++] = make_pair(
                    ps[j].vr[jj].getRatio(ps[i].vr[ii], ps[i].vr[ii + 1]), 1);
                buf[cnt++] = make_pair(
                    ps[j].vr[jj + 1].getRatio(ps[i].vr[ii], ps[i].vr[ii + 1]),
                    -1);
              }
            } else {
              s1 = ((ps[j].vr[jj + 1] - ps[j].vr[jj]) ^
                    (ps[i].vr[ii] - ps[j].vr[jj]));
              s2 = ((ps[j].vr[jj + 1] - ps[j].vr[jj]) ^
                    (ps[i].vr[ii + 1] - ps[j].vr[jj]));
            }
            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 j = 1; j < cnt; j++) {
          now = min(max(buf[j].first, 0.0), 1.0);
          if (!cov) sum += now - pre;
          cov += buf[j].second;
          pre = now;
        }
        ret += (ps[i].vr[ii] ^ ps[i].vr[ii + 1]) * sum;
      }
    }
    return ret / 2;
  }
} ch;
int main() {
  int nt = 4;
  double ret;
  while (~scanf("%d", &ch.tot)) {
    ret = 0;
    for (int i = 0; i < ch.tot; ++i) {
      ch.ps[i].n = nt;
      for (int j = 0; j < nt; ++j) {
        scanf("%lf%lf", &ch.ps[i].v[j].x, &ch.ps[i].v[j].y);
      }
      ret += ch.ps[i].getArea();
    }
    ret /= ch.getCombination();
    printf("%.9lf\n", ret);
  }
  return 0;
}
