#include <bits/stdc++.h>
using namespace std;
class Point {
 public:
  double x, y;
  Point() {}
  Point(double _x, double _y) {
    x = _x;
    y = _y;
  }
  Point operator-(const Point &p) { return Point(x - p.x, y - p.y); }
  Point operator+(const Point &p) { return Point(x + p.x, y + p.y); }
  Point operator*(const double k) { return Point(x * k, y * k); }
  double operator^(const Point &p) { return x * p.y - y * p.x; }
  double operator*(const Point &p) { return x * p.x + y * p.y; }
  void read() { scanf("%lf%lf", &x, &y); }
  double len() { return sqrt(x * x + y * y); }
  double len2() { return x * x + y * y; }
} p[105][4];
int n;
int forbid;
double ans = 0.0;
const double eps = 1e-9;
Point ret;
bool intersect(Point A, Point B, Point C, Point D) {
  double f1 = (A - C) ^ (B - C);
  double f2 = (B - D) ^ (A - D);
  if (fabs(f1 + f2) < eps) return false;
  f1 = f1 / (f1 + f2);
  if (f1 + eps < 0 || f1 > 1 + eps) return false;
  ret = C + (D - C) * f1;
  return true;
}
double cross(Point A, Point B) { return A ^ B; }
double dot(Point A, Point B) { return A * B; }
double handle(Point A, Point B) {
  vector<pair<double, int> > seg;
  A.x += 1e-6;
  A.y += 1e-6;
  B.x += 1e-6;
  B.y += 1e-6;
  for (int i = 0; i < n; i++) {
    if (i == forbid) continue;
    for (int j = 0; j < 3; j++)
      if (intersect(A, B, p[i][j], p[i][j + 1])) {
        double crs = cross(p[i][j] - A, B - A);
        double c1 = cross(p[i][(j + 2) % 3] - A, B - A);
        double c2 = cross(p[i][(j + 1) % 3] - A, B - A);
        int flg = (((c1 > 0) ^ (c2 > 0)) ? (c1 > 0 ? -1 : 1) : 0);
        if (crs > eps || (crs > -eps && flg == -1)) {
          seg.push_back(make_pair(dot(ret - A, B - A), -1));
        } else if (crs < -eps || (crs < eps && flg == 1)) {
          seg.push_back(make_pair(dot(ret - A, B - A), +1));
        }
      }
  }
  seg.push_back(make_pair(dot(B - A, B - A), 0));
  sort(seg.begin(), seg.end());
  double last = 0;
  double r = 0;
  int cnt = 0;
  for (int i = 0; i < (int)seg.size() && seg[i].first - eps < (B - A).len2();
       i++) {
    if (seg[i].first > last && cnt == 0) r += seg[i].first - last;
    cnt += seg[i].second;
    last = max(last, seg[i].first);
  }
  r /= (B - A).len();
  return r;
}
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) p[i][j].read();
    if (cross(p[i][1] - p[i][0], p[i][2] - p[i][0]) < 0) swap(p[i][1], p[i][2]);
    p[i][3] = p[i][0];
  }
  for (int i = 0; i < n; i++) {
    forbid = i;
    for (int j = 0; j < 3; j++) ans += handle(p[i][j], p[i][j + 1]);
  }
  printf("%.9f\n", ans);
  return 0;
}
