#include <bits/stdc++.h>
using namespace std;
struct pt {
  double x, y;
  pt() {}
  pt(double _x, double _y) : x(_x), y(_y) {}
  pt operator-(const pt p1) { return pt(x - p1.x, y - p1.y); }
  void read() { scanf("%lf%lf", &x, &y); }
};
double cpr(const pt &a, const pt &b, const pt &c) {
  return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
}
double cpr(const pt &a, const pt &b) { return a.x * b.y - a.y * b.x; }
double dpr(const pt &a, const pt &b) { return a.x * b.x + a.y * b.y; }
pt its(const pt &a, const pt &b, const pt &c, const pt &d) {
  pt ret = a;
  double t = ((c.x - a.x) * (d.y - c.y) - (c.y - a.y) * (d.x - c.x)) /
             ((b.x - a.x) * (d.y - c.y) - (b.y - a.y) * (d.x - c.x));
  ret.x += (b.x - a.x) * t;
  ret.y += (b.y - a.y) * t;
  return ret;
}
const int maxn = 1000;
int n[maxn];
pt p[maxn][1010];
int m;
pair<double, int> e[1010];
int cnt;
inline void insert(pt &s, pt &t, pt X, int inc) {
  double ratio = ((t.x - s.x) > 1e-8 ? 1 : ((t.x - s.x) > -1e-8 ? 0 : -1))
                     ? (X.x - s.x) / (t.x - s.x)
                     : (X.y - s.y) / (t.y - s.y);
  if (ratio > 1.0) ratio = 1.0;
  if (ratio < 0.0) ratio = 0.0;
  e[cnt++] = make_pair(ratio, inc);
}
double solve() {
  double ans = 0.0;
  int cp0, cp1, cp2, cp3;
  for (int i = 0; i < m; i++) {
    for (int k = 0; k < n[i]; k++) {
      pt &s = p[i][k], &t = p[i][k == n[i] - 1 ? 0 : k + 1];
      if (fabs(cpr(s, t)) < 1e-8) continue;
      cnt = 0;
      e[cnt++] = make_pair(0.0, 1);
      e[cnt++] = make_pair(1.0, -1);
      for (int j = 0; j < m; j++)
        if (i != j) {
          for (int l = 0; l < n[j]; l++) {
            cp0 = ((cpr(s, t, p[j][l == 0 ? n[j] - 1 : l - 1])) > 1e-8
                       ? 1
                       : ((cpr(s, t, p[j][l == 0 ? n[j] - 1 : l - 1])) > -1e-8
                              ? 0
                              : -1));
            cp1 = ((cpr(s, t, p[j][l])) > 1e-8
                       ? 1
                       : ((cpr(s, t, p[j][l])) > -1e-8 ? 0 : -1));
            cp2 = ((cpr(s, t, p[j][l == n[j] - 1 ? 0 : l + 1])) > 1e-8
                       ? 1
                       : ((cpr(s, t, p[j][l == n[j] - 1 ? 0 : l + 1])) > -1e-8
                              ? 0
                              : -1));
            if (cp1 * cp2 < 0)
              insert(s, t, its(s, t, p[j][l], p[j][l == n[j] - 1 ? 0 : l + 1]),
                     -cp2);
            else if (!cp1 && cp0 * cp2 < 0)
              insert(s, t, p[j][l], -cp2);
            else if (!cp1 && !cp2) {
              cp3 =
                  ((cpr(s, t, p[j][(l + 2) % n[j]])) > 1e-8
                       ? 1
                       : ((cpr(s, t, p[j][(l + 2) % n[j]])) > -1e-8 ? 0 : -1));
              double dp = dpr(t - s, p[j][l == n[j] - 1 ? 0 : l + 1] - p[j][l]);
              if (dp > 1e-8) {
                if (((cp0) > 1e-8 ? 1 : ((cp0) > -1e-8 ? 0 : -1)))
                  insert(s, t, p[j][l], 1 * ((j > i) ^ (cp0 < 0)));
                if (((cp3) > 1e-8 ? 1 : ((cp3) > -1e-8 ? 0 : -1)))
                  insert(s, t, p[j][l == n[j] - 1 ? 0 : l + 1],
                         -1 * ((j > i) ^ (cp3 < 0)));
              } else if (dp < -1e-8) {
                if (((cp0) > 1e-8 ? 1 : ((cp0) > -1e-8 ? 0 : -1)))
                  insert(s, t, p[j][l], 1 * (cp0 > 0));
                if (((cp3) > 1e-8 ? 1 : ((cp3) > -1e-8 ? 0 : -1)))
                  insert(s, t, p[j][l == n[j] - 1 ? 0 : l + 1], -1 * (cp3 > 0));
              }
            }
          }
        }
      sort(e, e + cnt);
      int acc = 0;
      double total = 0.0, last;
      for (int j = 0; j < cnt; j++) {
        if (acc == 1) total += e[j].first - last;
        acc += e[j].second;
        last = e[j].first;
      }
      ans += cpr(s, t) * total;
    }
  }
  return fabs(ans) * 0.5;
}
double dis(pt p1, pt p2) {
  p1.x -= p2.x;
  p1.y -= p2.y;
  return p1.x * p1.x + p1.y * p1.y;
}
void pre(pt p[], int n) {
  double sum = 0;
  p[n] = p[0];
  for (int i = 0; i < n; i++) sum += p[i].x * p[i + 1].y - p[i + 1].x * p[i].y;
  pt tp[maxn];
  if (sum < 0) {
    for (int i = 0; i < n; i++) tp[i] = p[n - 1 - i];
    for (int i = 0; i < n; i++) p[i] = tp[i];
  }
}
int main() {
  while (scanf("%d", &m) != EOF) {
    for (int i = 0; i < m; i++) n[i] = 4;
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < 4; j++) p[i][j].read();
      pre(p[i], 4);
    }
    double ans = solve();
    double area = 0;
    for (int i = 0; i < m; i++) {
      double l1 = dis(p[i][0], p[i][1]);
      double l2 = dis(p[i][1], p[i][2]);
      double tmp = sqrt(l1 * l2);
      area += tmp;
    }
    double p = area / ans;
    printf("%.10lf\n", p);
  }
  return 0;
}
