#include <bits/stdc++.h>
using namespace std;
int n;
pair<double, int> c[10000];
const double eps = 1e-10;
const double PI = acos(-1.0);
struct Point {
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
};
Point operator-(Point a, Point b) { return Point(a.x - b.x, a.y - b.y); }
Point operator+(Point a, Point b) { return Point(a.x + b.x, a.y + b.y); }
Point operator*(Point a, double p) { return Point(a.x * p, a.y * p); }
Point operator/(Point a, double p) { return Point(a.x / p, a.y / p); }
bool operator<(const Point& a, const Point& b) {
  return a.x < b.x || (a.x == b.x && a.y < b.y);
}
int dcmp(double x) {
  if (fabs(x) < eps) return 0;
  if (x < 0) return -1;
  return 1;
}
bool operator==(const Point& a, const Point& b) {
  return dcmp(a.x - b.x) == 0 && dcmp(a.y - b.y) == 0;
}
double Dot(Point a, Point b) { return a.x * b.x + a.y * b.y; }
double Cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
vector<Point> p[600];
double segP(Point p1, Point p2, Point p3) {
  if (dcmp(p2.x - p3.x))
    return (p1.x - p2.x) / (p3.x - p2.x);
  else
    return (p1.y - p2.y) / (p3.y - p2.y);
}
double polyUnion() {
  int i, j, ii, jj, ta, tb, r, d;
  double z, w, s, sum, tc, td;
  Point tmp1, tmp2;
  sum = 0;
  for (i = 0; i < n; ++i)
    for (ii = 0; ii < p[i].size() - 1; ++ii) {
      r = 0;
      c[r++] = make_pair(0., 0);
      c[r++] = make_pair(1., 0);
      for (j = 0; j < n; ++j)
        if (i - j)
          for (jj = 0; jj < p[j].size() - 1; ++jj) {
            ta = dcmp(Cross(p[i][ii + 1] - p[i][ii], p[j][jj] - p[i][ii]));
            tb = dcmp(Cross(p[i][ii + 1] - p[i][ii], p[j][jj + 1] - p[i][ii]));
            if (!ta && !tb) {
              tmp1.x = p[j][jj + 1].x - p[j][jj].x;
              tmp1.y = p[j][jj + 1].y - p[j][jj].y;
              tmp2.x = p[i][ii + 1].x - p[i][ii].x;
              tmp2.y = p[i][ii + 1].y - p[i][ii].y;
              if (dcmp(Dot(tmp1, tmp2)) > 0 && j < i) {
                c[r++] = make_pair(segP(p[j][jj], p[i][ii], p[i][ii + 1]), 1);
                c[r++] =
                    make_pair(segP(p[j][jj + 1], p[i][ii], p[i][ii + 1]), -1);
              }
            } else if (ta >= 0 && tb < 0) {
              tc = Cross(p[j][jj + 1] - p[j][jj], p[i][ii] - p[j][jj]);
              td = Cross(p[j][jj + 1] - p[j][jj], p[i][ii + 1] - p[j][jj]);
              c[r++] = make_pair(tc / (tc - td), 1);
            } else if (ta < 0 && tb >= 0) {
              tc = Cross(p[j][jj + 1] - p[j][jj], p[i][ii] - p[j][jj]);
              td = Cross(p[j][jj + 1] - p[j][jj], p[i][ii + 1] - p[j][jj]);
              c[r++] = make_pair(tc / (tc - td), -1);
            }
          }
      sort(c, c + r);
      z = min(max(c[0].first, 0.), 1.);
      d = c[0].second;
      s = 0;
      for (j = 1; j < r; ++j) {
        w = min(max(c[j].first, 0.), 1.);
        if (!d) s += w - z;
        d += c[j].second;
        z = w;
      }
      tmp1.x = tmp1.y = 0;
      sum += Cross(p[i][ii], p[i][ii + 1]) * s;
    }
  return 0.5 * sum;
}
int main() {
  int i, j;
  double area, tmp;
  Point k;
  while (scanf("%d", &n) != EOF) {
    area = 0;
    for (i = 0; i < n; ++i) {
      for (j = 0; j < 4; ++j) {
        scanf("%lf %lf", &k.x, &k.y);
        p[i].push_back(k);
      }
      p[i].push_back(p[i][0]);
      tmp = 0;
      for (j = 1; j <= 4; ++j)
        tmp += p[i][j - 1].x * p[i][j].y - p[i][j - 1].y * p[i][j].x;
      area += fabs(tmp);
      if (dcmp(tmp) < 0) swap(p[i][1], p[i][3]);
    }
    double z = polyUnion();
    printf("%.10f\n", 0.5 * area / z);
  }
  return 0;
}
