#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long infLL = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-8;
int sgn(double x) { return x < -eps ? -1 : x > eps; }
bool zero(complex<double> v) { return !sgn(v.real()) && !sgn(v.imag()); }
double dot(complex<double> u, complex<double> v) {
  return u.real() * v.real() + u.imag() * v.imag();
}
double cross(complex<double> u, complex<double> v) {
  return u.real() * v.imag() - u.imag() * v.real();
}
complex<double> unit(complex<double> v) { return v / abs(v); }
complex<double> normal(complex<double> v) {
  return complex<double>(-v.imag(), v.real());
}
complex<double> rotate(complex<double> v, double a) {
  return v * polar(1.0, a);
}
complex<double> proj(complex<double> u, complex<double> v) {
  return v * dot(u, v) / norm(v);
}
complex<double> reflect(complex<double> u, complex<double> v) {
  return proj(u, v) * 2.0 - u;
}
double polygon_area(const vector<complex<double> > &g) {
  double res = 0;
  for (int i = 1; i < (int)g.size() - 1; ++i)
    res += cross(g[i] - g[0], g[i + 1] - g[0]);
  return res / 2;
}
void polygon_union(vector<complex<double> > g[], int n, double area[]) {
  for (int i = 0; i <= n; ++i) area[i] = 0;
  for (int u = 0; u < n; ++u)
    for (int i = 0; i < (int)g[u].size(); ++i) {
      vector<pair<double, int> > vec;
      complex<double> a = (i ? g[u][i - 1] : g[u].back()), b = g[u][i];
      for (int v = 0; v < n; ++v)
        if (v != u)
          for (int j = 0; j < (int)g[v].size(); ++j) {
            complex<double> c = (j ? g[v][j - 1] : g[v].back()), d = g[v][j];
            int c1 = sgn(cross(b - a, c - a)), c2 = sgn(cross(b - a, d - a)),
                d1 = sgn(dot(b - a, d - c));
            if (c1 || c2) {
              if ((c1 ^ c2) >= 0) continue;
              double s1 = cross(d - c, a - c), s2 = cross(d - c, b - c);
              double k = s1 / (s1 - s2);
              int t = (c1 >= 0 ? 1 : -1);
              vec.push_back(make_pair(k, t));
            } else if (u < v && d1 > 0) {
              double k;
              k = ((c - a) / (b - a)).real();
              vec.push_back(make_pair(k, 1));
              k = ((d - a) / (b - a)).real();
              vec.push_back(make_pair(k, -1));
            }
          }
      vec.push_back(make_pair(0.0, 0));
      vec.push_back(make_pair(1.0, 0));
      sort(vec.begin(), vec.end());
      double s = 0.5 * cross(a, b), p = min(max(vec[0].first, 0.0), 1.0);
      int k = vec[0].second;
      for (int j = 1; j < (int)vec.size(); ++j) {
        double q = min(max(vec[j].first, 0.0), 1.0);
        area[k] += s * (q - p);
        p = q;
        k += vec[j].second;
      }
    }
}
const int maxn = 500 + 5;
int n;
vector<complex<double> > g[maxn];
double area[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (4); ++j) {
      int x, y;
      scanf("%d%d", &x, &y);
      g[i].push_back(complex<double>(x, y));
    }
    double tmp = polygon_area(g[i]);
    if (sgn(tmp) < 0) reverse(g[i].begin(), g[i].end());
  }
  polygon_union(g, n, area);
  double res = 0;
  for (int i = (1); i <= (n); ++i) res += (area[i - 1] - area[i]) * i;
  printf("%.10f\n", res / area[0]);
  return 0;
}
