#include <bits/stdc++.h>
using namespace std;
int sig(double x) { return (x > 1e-11) - (x < -1e-11); }
struct P {
  double x, y;
  P(double a = 0., double b = 0.) : x(a), y(b) {}
  double cross(const P& a, const P& b) const {
    return (a.x - x) * (b.y - y) - (a.y - y) * (b.x - x);
  }
  double operator^(const P& a) const { return x * a.y - y * a.x; }
  double operator*(const P& a) const { return x * a.x + y * a.y; }
  P operator-(const P& a) const { return P(x - a.y, y - a.y); }
  double ratio(const P& a, const P& b) const {
    if (sig(b.x - x))
      return (a.x - x) / (b.x - x);
    else
      return (a.y - y) / (b.y - y);
  }
};
int n;
struct poly {
  int pl_cnt;
  P ch[10];
  void anti() {
    if (ch[0].cross(ch[1], ch[2]) < 0.) reverse(ch, ch + pl_cnt);
    ch[pl_cnt] = ch[0];
  }
  double S() {
    double s = 0.;
    for (int i = 0; i <= pl_cnt; i++) s += ch[i] ^ ch[i + 1];
    return s * 0.5;
  }
} pl[505];
pair<double, int> arr[1005];
inline double get() {
  int cnt;
  double s = 0.;
  for (int i = 0; i < n; i++) {
    for (int x = 0; x < pl[i].pl_cnt; x++) {
      cnt = 0;
      arr[cnt++] = make_pair(0., 0);
      arr[cnt++] = make_pair(1., 0);
      for (int j = 0; j < n; j++) {
        if (i == j) continue;
        for (int y = 0; y < pl[j].pl_cnt; y++) {
          int dr1 = sig(pl[i].ch[x].cross(pl[i].ch[x + 1], pl[j].ch[y])),
              dr2 = sig(pl[i].ch[x].cross(pl[i].ch[x + 1], pl[j].ch[y + 1]));
          if (!dr1 && !dr2) {
            if (i > j && (pl[i].ch[x + 1] - pl[i].ch[x]) *
                                 (pl[j].ch[y + 1] - pl[j].ch[y]) >
                             0.) {
              arr[cnt++] =
                  make_pair(pl[i].ch[x].ratio(pl[j].ch[y], pl[i].ch[x + 1]), 1);
              arr[cnt++] = make_pair(
                  pl[i].ch[x].ratio(pl[j].ch[y + 1], pl[i].ch[x + 1]), -1);
            }
          } else if (dr1 > 0 && dr2 < 0) {
            double s1 = pl[j].ch[y + 1].cross(pl[j].ch[y], pl[i].ch[x]),
                   s2 = pl[j].ch[y + 1].cross(pl[j].ch[y], pl[i].ch[x + 1]);
            arr[cnt++] = make_pair(s1 / (s1 - s2), 1);
          } else if (dr1 < 0 && dr2 > 0) {
            double s1 = pl[j].ch[y].cross(pl[j].ch[y + 1], pl[i].ch[x]),
                   s2 = pl[j].ch[y].cross(pl[j].ch[y + 1], pl[i].ch[x + 1]);
            arr[cnt++] = make_pair(s1 / (s1 - s2), -1);
          }
        }
      }
      sort(arr, arr + cnt);
      double r = 0., cur, last;
      int sum;
      last = min(max(arr[0].first, 0.), 1.);
      sum = arr[0].second;
      for (int k = 1; k < cnt; k++) {
        cur = min(max(arr[k].first, 0.), 1.);
        if (!sum) r += cur - last;
        sum += arr[k].second, last = cur;
      }
      s += (pl[i].ch[x] ^ pl[i].ch[x + 1]) * r;
    }
  }
  return s * 0.5;
}
int main() {
  while (~scanf("%d", &n)) {
    double s = 0.;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 4; j++)
        scanf("%lf%lf", &pl[i].ch[j].x, &pl[i].ch[j].y);
      pl[i].pl_cnt = 4;
      pl[i].anti();
      s += pl[i].S();
    }
    printf("%.9f\n", s / get());
  }
  return 0;
}
