#include <bits/stdc++.h>
using namespace std;
inline int FSGN(double x) {
  if (x > (1e-6)) return 1;
  if (x >= -(1e-6)) return 0;
  return -1;
}
struct vec2 {
  double x, y;
  vec2() : x(0.0), y(0.0) {}
  vec2(double x, double y) : x(x), y(y) {}
  vec2 operator+(const vec2 &v) const { return vec2(x + v.x, y + v.y); }
  vec2 operator-(const vec2 &v) const { return vec2(x - v.x, y - v.y); }
  double operator*(const vec2 &v) const { return x * v.x + y * v.y; }
  vec2 operator/(const double k) const { return vec2(x / k, y / k); }
  double operator^(const vec2 &v) const { return x * v.y - y * v.x; }
  bool operator==(const vec2 &v) const {
    return fabs(x - v.x) < (1e-6) && fabs(y - v.y) < (1e-6);
  }
  double len() { return sqrt(x * x + y * y); }
  double getRatio(vec2 &a, vec2 &b) {
    if (fabs(b.x - a.x) < (1e-6)) return (y - a.y) / (b.y - a.y);
    return (x - a.x) / (b.x - a.x);
  }
};
struct Polygon2D {
  int n;
  int nr;
  vec2 *v;
  vec2 *vr;
  vec2 *buf;
  Polygon2D() {
    v = new vec2[10];
    vr = new vec2[10];
    buf = new vec2[10];
  }
  ~Polygon2D() {
    delete[] v;
    delete[] vr;
    delete[] buf;
  }
  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-6); ++i)
      ;
    di = ((v[i + 1] - v[i]) ^ (v[i + 2] - v[i])) > (1e-6) ? 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 * 510];
    ps = new Polygon2D[510];
  }
  ~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;
}
