#include <bits/stdc++.h>
const double INF = 1e9 + 7;
const int N = 1e5 + 100;
using namespace std;
const double eps = 1e-8;
int cmp(double x) {
  if (fabs(x) < eps)
    return 0;
  else
    return x > 0 ? 1 : -1;
}
bool equal(double x, double y) { return cmp(x - y) == 0; }
struct Point {
  double x, y;
  Point(double _x = 0, double _y = 0) : x(_x), y(_y) {}
  friend Point operator+(const Point &A, const Point &B) {
    return Point(A.x + B.x, A.y + B.y);
  }
  friend Point operator-(const Point &A, const Point &B) {
    return Point(A.x - B.x, A.y - B.y);
  }
  friend double operator*(const Point &A, const Point &B) {
    return A.x * B.x + A.y * B.y;
  }
  friend double operator^(const Point &A, const Point &B) {
    return A.x * B.y - A.y * B.x;
  }
  friend Point operator*(const Point &A, const double &k) {
    return Point(A.x * k, A.y * k);
  }
  friend Point operator*(const double &k, const Point &A) {
    return Point(A.x * k, A.y * k);
  }
  void read() { scanf("%lf%lf", &x, &y); }
  void write() { printf("%lf %lf\n", x, y); }
};
Point V;
bool cmpP(pair<Point, int> A, pair<Point, int> B) {
  return cmp((B.first - A.first) * V) == 1;
}
struct Line {
  Point S, T;
  Line(Point _S = Point(0, 0), Point _T = Point(0, 0)) : S(_S), T(_T) {}
  friend Point Two_Line_Intersect(Line A, Line B) {
    if (cmp((A.T - A.S) ^ (B.T - B.S)) == 0) {
      if (cmp((A.S - B.S) ^ (A.S - B.T)) == 0)
        return Point(0, INF);
      else
        return Point(1, INF);
    } else {
      double k = ((B.T - A.T) ^ (A.S - A.T)) / ((B.T - B.S) ^ (A.S - A.T));
      return B.T + (B.S - B.T) * k;
    }
  }
  void write() {
    S.write();
    T.write();
    puts("");
  }
} L[N << 2];
int lcnt = 0;
int tot = 0;
pair<Point, int> P[6001];
bool Del[6001];
double ans = 0;
double area = 0;
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    Point A, B, C, D;
    A.read();
    B.read();
    C.read();
    D.read();
    if (cmp((B - A) ^ (C - A)) < 0) swap(A, D), swap(B, C);
    L[++lcnt] = Line(A, B);
    L[++lcnt] = Line(B, C);
    L[++lcnt] = Line(C, D);
    L[++lcnt] = Line(D, A);
    ans = ans + (A ^ B) / 2 + (B ^ C) / 2 + (C ^ D) / 2 + (D ^ A) / 2;
  }
  for (int i = 1; i <= lcnt; ++i) {
    if (Del[i] == 1) continue;
    int tot = 0;
    for (int j = 1; j <= lcnt; ++j) {
      int t = cmp((L[j].T - L[j].S) ^ (L[i].T - L[i].S));
      if (t != 0) {
        Point now = Two_Line_Intersect(L[i], L[j]);
        if (cmp((now - L[j].S) * (L[j].T - now)) >= 0)
          P[++tot] = make_pair(now, t);
      } else {
        if (cmp((L[i].S - L[j].S) ^ (L[i].T - L[i].S)) == 0) {
          Del[j] = 1;
          P[++tot] = make_pair(L[j].S, 2);
          P[++tot] = make_pair(L[j].T, -2);
        }
      }
    }
    V = L[i].T - L[i].S;
    stable_sort(P + 1, P + 1 + tot, cmpP);
    int cnt = 0;
    int ct = 0;
    for (int i = 1; i < tot; ++i) {
      if (abs(P[i].second) > 1) {
        ct += P[i].second / 2;
      } else
        cnt += P[i].second;
      if (cnt > 0 && cnt == ct) {
        area += (P[i].first ^ P[i + 1].first) / 2;
      }
    }
  }
  cout << fixed << setprecision(10) << ans / area;
  return 0;
}
