#include <bits/stdc++.h>
using namespace std;
pair<double, double> operator+(pair<double, double> a, pair<double, double> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
pair<double, double> operator-(pair<double, double> a, pair<double, double> b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
double operator*(pair<double, double> a, pair<double, double> b) {
  return a.first * b.second - b.first * a.second;
}
double operator^(pair<double, double> a, pair<double, double> b) {
  return a.first * b.first + a.second * b.second;
}
inline double cross(pair<double, double> o, pair<double, double> a,
                    pair<double, double> b) {
  return (a - o) * (b - o);
}
inline int cmp(double first) {
  if (fabs(first) < 1e-8) return 0;
  return first > 0 ? 1 : -1;
}
class Polygon {
 private:
  int i;
  double s;

 public:
  int n;
  pair<double, double> p[5];
  pair<double, double>& operator[](int idx) { return p[idx]; }
  void input() {
    for (i = 0; i < n; i++) scanf("%lf %lf", &p[i].first, &p[i].second);
    p[n] = p[0];
  }
  double Area() {
    for (s = 0, i = 0; i < n; i++) s += p[i] * p[i + 1];
    return s / 2;
  }
};
pair<double, int> s[502 * 5 * 2];
Polygon P[502];
double S, ts;
int N;
inline double seg(pair<double, double> o, pair<double, double> a,
                  pair<double, double> b) {
  if (cmp(b.first - a.first) == 0)
    return (o.second - a.second) / (b.second - a.second);
  return (o.first - a.first) / (b.first - a.first);
}
double PolygonUnion() {
  int M, c1, c2;
  double s1, s2, ret = 0;
  for (int i = 0; i < N; i++)
    for (int ii = 0; ii < P[i].n; ii++) {
      M = 0;
      s[M++] = make_pair(0.00, 0);
      s[M++] = make_pair(1.00, 0);
      for (int j = 0; j < N; j++)
        if (i != j)
          for (int jj = 0; jj < P[j].n; jj++) {
            c1 = cmp(cross(P[i][ii], P[i][ii + 1], P[j][jj]));
            c2 = cmp(cross(P[i][ii], P[i][ii + 1], P[j][jj + 1]));
            if (c1 == 0 && c2 == 0) {
              if (((P[i][ii + 1] - P[i][ii]) ^ (P[j][jj + 1] - P[j][jj])) > 0 &&
                  i > j) {
                s[M++] = make_pair(seg(P[j][jj], P[i][ii], P[i][ii + 1]), 1);
                s[M++] =
                    make_pair(seg(P[j][jj + 1], P[i][ii], P[i][ii + 1]), -1);
              }
            } else {
              s1 = cross(P[j][jj], P[j][jj + 1], P[i][ii]);
              s2 = cross(P[j][jj], P[j][jj + 1], P[i][ii + 1]);
              if (c1 >= 0 && c2 < 0)
                s[M++] = make_pair(s1 / (s1 - s2), 1);
              else if (c1 < 0 && c2 >= 0)
                s[M++] = make_pair(s1 / (s1 - s2), -1);
            }
          }
      sort(s, s + M);
      double pre = min(max(s[0].first, 0.0), 1.0), now;
      double sum = 0;
      int cov = s[0].second;
      for (int j = 1; j < M; j++) {
        now = min(max(s[j].first, 0.0), 1.0);
        if (!cov) sum += now - pre;
        cov += s[j].second;
        pre = now;
      }
      ret += P[i][ii] * P[i][ii + 1] * sum;
    }
  return ret / 2;
}
int main() {
  scanf("%d\n", &N);
  for (int i = 0; i < N; i++) {
    P[i].n = 4;
    P[i].input();
    ts = P[i].Area();
    if (cmp(ts < 0)) {
      reverse(P[i].p, P[i].p + P[i].n);
      P[i][P[i].n] = P[i][0];
      ts = -ts;
    }
    S += ts;
  }
  printf("%.9lf\n", S / PolygonUnion());
}
