#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
inline int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') ch = getchar(), o = -1;
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o + 10000;
}
inline int jud(double x) {
  if (fabs(x) < eps) return 0;
  return x > 0 ? 1 : -1;
}
namespace Geometry {
struct Poi {
  double x, y;
  Poi() {}
  Poi(double x, double y) : x(x), y(y) {}
  inline void init() { scanf("%lf%lf", &x, &y); }
};
struct Lin {
  Poi p, v;
  Lin() {}
  Lin(Poi p, Poi v) : p(p), v(v) {}
};
inline Poi operator+(const Poi &A, const Poi &B) {
  return Poi(A.x + B.x, A.y + B.y);
}
inline Poi operator-(const Poi &A, const Poi &B) {
  return Poi(A.x - B.x, A.y - B.y);
}
inline Poi operator*(const Poi &A, double t) { return Poi(A.x * t, A.y * t); }
inline double operator*(const Poi &A, const Poi &B) {
  return A.x * B.x + A.y * B.y;
}
inline double operator^(const Poi &A, const Poi &B) {
  return A.x * B.y - A.y * B.x;
}
inline bool operator==(const Lin &A, const Lin &B) {
  return !(A.v ^ B.v) && !((B.p - A.p) ^ A.v);
}
inline Poi Inter(const Lin &A, const Lin &B) {
  double t = (B.v ^ (A.p - B.p)) / (A.v ^ B.v);
  return A.p + A.v * t;
}
}  // namespace Geometry
using namespace Geometry;
Lin A[(2010)];
pair<Poi, int> B[(2010)];
bool del[(2010)];
struct cmp {
  Poi p;
  cmp(const Poi &p) : p(p) {}
  inline bool operator()(const pair<Poi, int> &A, const pair<Poi, int> &B) {
    return jud((B.first - A.first) * p) == 1;
  }
};
int main() {
  int n, m = 0, k;
  double sum = 0, val = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    Poi a, b, c, d;
    a.init(), b.init(), c.init(), d.init();
    if (jud((b - a) ^ (c - a)) < 0) swap(a, d), swap(b, c);
    A[++m] = Lin(a, b - a);
    A[++m] = Lin(b, c - b);
    A[++m] = Lin(c, d - c);
    A[++m] = Lin(d, a - d);
    sum += (a ^ b) + (b ^ c) + (c ^ d) + (d ^ a);
  }
  sum /= 2;
  for (int i = 1; i <= m; i++) {
    if (del[i]) continue;
    k = 0;
    for (int j = 1; j <= m; j++) {
      int t = jud(A[j].v ^ A[i].v);
      if (t) {
        Poi p = Inter(A[i], A[j]);
        if (jud((p - A[j].p) * (A[j].p + A[j].v - p)) != -1)
          B[++k] = pair<Poi, int>(p, t);
      } else if (!jud((A[i].p - A[j].p) ^ A[i].v)) {
        del[j] = 1;
        B[++k] = pair<Poi, int>(A[j].p, 2),
        B[++k] = pair<Poi, int>(A[j].p + A[j].v, -2);
      }
    }
    sort(B + 1, B + 1 + k, cmp(A[i].v));
    for (int j = 1, in = 0, cov = 0; j < k; j++) {
      if (abs(B[j].second) == 2)
        cov += B[j].second / 2;
      else
        in += B[j].second;
      if (in && in == cov) val += (B[j].first ^ B[j + 1].first) / 2;
    }
  }
  printf("%.10f", sum / val);
  return 0;
}
