#include <bits/stdc++.h>
using namespace std;
const int Maxn = 300;
const long double sm = 0.0001;
int n;
pair<pair<long double, long double>, pair<long double, long double> > seg[Maxn];
set<pair<long double, long double> > dots[Maxn];
long double ans;
long double LL(const pair<pair<long double, long double>,
                          pair<long double, long double> > &p) {
  return sqrt(
      (p.first.first - p.second.first) * (p.first.first - p.second.first) +
      (p.first.second - p.second.second) * (p.first.second - p.second.second));
}
long double TP(long double a, long double b, long double c) {
  long double p = (a + b + c) / 2;
  return sqrt(p) * sqrt(p - a) * sqrt(p - b) * sqrt(p - c);
}
bool isIn(long double x, long double y, int num) {
  pair<long double, long double> p = make_pair(x, y);
  long double second =
      TP(LL(seg[3 * num]), LL(seg[3 * num + 1]), LL(seg[3 * num + 2]));
  long double s1 = TP(LL(seg[3 * num]), LL(make_pair(p, seg[3 * num].first)),
                      LL(make_pair(p, seg[3 * num].second)));
  long double s2 =
      TP(LL(seg[3 * num + 1]), LL(make_pair(p, seg[3 * num + 1].first)),
         LL(make_pair(p, seg[3 * num + 1].second)));
  long double s3 =
      TP(LL(seg[3 * num + 2]), LL(make_pair(p, seg[3 * num + 2].first)),
         LL(make_pair(p, seg[3 * num + 2].second)));
  return fabs(second - s1 - s2 - s3) < sm;
}
int main() {
  long double p[6], num, den, a, b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 6; j++) cin >> p[j];
    seg[3 * i] = make_pair(make_pair(p[0], p[1]), make_pair(p[2], p[3]));
    dots[3 * i].insert(make_pair(p[0], p[1]));
    dots[3 * i].insert(make_pair(p[2], p[3]));
    seg[3 * i + 1] = make_pair(make_pair(p[0], p[1]), make_pair(p[4], p[5]));
    dots[3 * i + 1].insert(make_pair(p[0], p[1]));
    dots[3 * i + 1].insert(make_pair(p[4], p[5]));
    seg[3 * i + 2] = make_pair(make_pair(p[2], p[3]), make_pair(p[4], p[5]));
    dots[3 * i + 2].insert(make_pair(p[2], p[3]));
    dots[3 * i + 2].insert(make_pair(p[4], p[5]));
  }
  for (int i = 0; i < 3 * n; i++)
    for (int j = 0; j < 3 * n; j++) {
      long double num, den;
      num = (seg[j].first.first - seg[i].first.first) *
                (seg[i].second.second - seg[i].first.second) -
            (seg[j].first.second - seg[i].first.second) *
                (seg[i].second.first - seg[i].first.first);
      den = (seg[i].second.first - seg[i].first.first) *
                (seg[j].second.second - seg[j].first.second) -
            (seg[i].second.second - seg[i].first.second) *
                (seg[j].second.first - seg[j].first.first);
      if (fabs(den) < sm) continue;
      b = num / den;
      if (b < 0 || b > 1) continue;
      num = seg[j].first.first - seg[i].first.first +
            (seg[j].second.first - seg[j].first.first) * b;
      den = seg[i].second.first - seg[i].first.first;
      if (fabs(den) < sm) continue;
      a = num / den;
      if (a < 0 || a > 1) continue;
      dots[i].insert(make_pair(
          seg[i].first.first + (seg[i].second.first - seg[i].first.first) * a,
          seg[i].first.second +
              (seg[i].second.second - seg[i].first.second) * a));
      dots[j].insert(make_pair(
          seg[i].first.first + (seg[i].second.first - seg[i].first.first) * a,
          seg[i].first.second +
              (seg[i].second.second - seg[i].first.second) * a));
    }
  for (int i = 0; i < 3 * n; i++) {
    set<pair<long double, long double> >::iterator lit, it;
    it = dots[i].begin();
    lit = it++;
    for (; it != dots[i].end(); lit++, it++) {
      a = (lit->first + it->first) / 2.;
      b = (lit->second + it->second) / 2.;
      int j;
      for (j = 0; j < n; j++)
        if (j != i / 3)
          if (isIn(a, b, j)) break;
      if (j == n)
        ans += sqrt((it->first - lit->first) * (it->first - lit->first) +
                    (it->second - lit->second) * (it->second - lit->second));
    }
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
