#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 10;
const long double eps = 1e-10;
inline int dblcmp(long double x) {
  if (fabs(x) < eps) return 0;
  return x > 0 ? 1 : -1;
}
int n, m;
struct Point {
  long double x, y;
  Point() {}
  Point(long double x, long double y) : x(x), y(y) {}
  void input() { cin >> x >> y; }
};
Point operator+(const Point& a, const Point& b) {
  return Point(a.x + b.x, a.y + b.y);
}
Point operator-(const Point& a, const Point& b) {
  return Point(a.x - b.x, a.y - b.y);
}
Point operator*(const Point& a, long double t) {
  return Point(a.x * t, a.y * t);
}
Point operator*(long double t, const Point& a) {
  return Point(a.x * t, a.y * t);
}
long double operator*(const Point& a, const Point& b) {
  return a.x * b.x + a.y * b.y;
}
long double operator%(const Point& a, const Point& b) {
  return a.x * b.y - a.y * b.x;
}
struct Line {
  Point p, v;
  Line() {}
  Line(Point p, Point v) : p(p), v(v) {}
} C[N * 4];
Point getIntersection(const Line& a, const Line& b) {
  long double t = b.v % (a.p - b.p) / (a.v % b.v);
  return a.p + a.v * t;
}
pair<Point, int> L[N * 4];
bool del[N * 4];
bool operator==(const Line& a, const Line& b) {
  return dblcmp(a.v % b.v) == 0 && dblcmp((b.p - a.p) % a.v) == 0;
}
struct cmp {
  Point p;
  cmp(const Point& p) : p(p) {}
  bool operator()(const pair<Point, int>& a, const pair<Point, int>& b) {
    return dblcmp((b.first - a.first) * p) == 1;
  }
};
long double ans, area;
void solve() {
  cin >> n;
  for (int i = (1); i <= (n); ++i) {
    Point a, b, c, d;
    a.input();
    b.input();
    c.input();
    d.input();
    if (dblcmp((b - a) % (c - a)) < 0) swap(a, d), swap(b, c);
    C[++m] = Line(a, b - a);
    C[++m] = Line(b, c - b);
    C[++m] = Line(c, d - c);
    C[++m] = Line(d, a - d);
    ans += a % b / 2 + b % c / 2 + c % d / 2 + d % a / 2;
  }
  for (int i = (1); i <= (m); ++i)
    if (!del[i]) {
      n = 0;
      for (int j = (1); j <= (m); ++j) {
        int t = dblcmp(C[j].v % C[i].v);
        if (t) {
          Point p = getIntersection(C[i], C[j]);
          if (dblcmp((p - C[j].p) * (C[j].p + C[j].v - p)) >= 0)
            L[++n] = make_pair(p, t);
        } else if (dblcmp((C[i].p - C[j].p) % C[i].v) == 0) {
          del[j] = 1;
          L[++n] = make_pair(C[j].p, 2);
          L[++n] = make_pair(C[j].p + C[j].v, -2);
        }
      }
      sort(L + 1, L + 1 + n, cmp(C[i].v));
      int cnt = 0, ct = 0;
      for (int j = (1); j <= (n - 1); ++j) {
        if (abs(L[j].second) > 1) {
          ct += L[j].second / 2;
        } else
          cnt += L[j].second;
        if (cnt > 0 && cnt == ct) {
          area += L[j].first % L[j + 1].first / 2;
        }
      }
    }
  ans /= area;
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(9);
  solve();
  return 0;
}
