#include <bits/stdc++.h>
using namespace std;
int nextInt() {
  int x;
  scanf("%d", &x);
  return x;
}
struct Point {
  double x, y;
  Point() {}
  Point(double x, double y) : x(x), y(y) {}
  Point operator-(const Point &op) const { return Point(x - op.x, y - op.y); }
  Point operator+(const Point &op) const { return Point(x + op.x, y + op.y); }
  Point operator*(const double &op) const { return Point(x * op, y * op); }
  double operator%(const Point &op) const { return x * op.y - y * op.x; }
  double length() { return sqrt(x * x + y * y); }
};
Point nextPoint() {
  double x = nextInt();
  double y = nextInt();
  return Point(x, y);
}
const int N = 110;
Point p[N][3];
const double eps = 1e-9;
double getIntPar(Point s1, Point e1, Point s2, Point e2) {
  double d = (e1 - s1) % (e2 - s2);
  if (fabs(d) <= eps) {
    return -1;
  }
  double p = -((s1 - s2) % (e2 - s2)) / d;
  return p;
}
int sign(double x) { return x < -eps ? -1 : x > eps ? 1 : 0; }
int cmp(double x, double y) {
  double tol = eps * max(1.0, max(fabs(x), fabs(y)));
  return x - y < -tol ? -1 : x - y > tol ? 1 : 0;
}
int cmpOrient(Point a, Point b) { return cmp(a.x * b.y, a.y * b.x); }
bool contain(Point p, Point a, Point b, Point c) {
  int s1 = cmpOrient(p - a, b - a);
  int s2 = cmpOrient(p - b, c - b);
  int s3 = cmpOrient(p - c, a - c);
  bool cnt[3] = {0, 0, 0};
  ++cnt[s1 + 1];
  ++cnt[s2 + 1];
  ++cnt[s3 + 1];
  int total = cnt[0] + cnt[1] + cnt[2];
  return total == 1 && cnt[1] == 0;
}
bool contain(Point pt, int n) {
  for (int i = 0; i < n; ++i) {
    if (contain(pt, p[i][0], p[i][1], p[i][2])) {
      return true;
    }
  }
  return false;
}
double getLen(Point s, Point e, int n) {
  vector<double> params;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      double par = getIntPar(s, e, p[i][j], p[i][(j + 1) % 3]);
      if (eps < par && par < 1 - eps) {
        params.push_back(par);
      }
    }
  }
  params.push_back(0);
  params.push_back(1);
  sort(params.begin(), params.end());
  double res = 0;
  for (int i = 1; i < params.size(); ++i) {
    double par = (params[i - 1] + params[i]) / 2;
    Point pt = s + (e - s) * par;
    if (!contain(pt, n)) {
      res += params[i] - params[i - 1];
    }
  }
  res *= (e - s).length();
  return res;
}
int main() {
  int n = nextInt();
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      p[i][j] = nextPoint();
    }
  }
  double res = 0;
  for (int i = 0; i < n; ++i) {
    res += getLen(p[i][0], p[i][1], n);
    res += getLen(p[i][0], p[i][2], n);
    res += getLen(p[i][2], p[i][1], n);
  }
  printf("%.10lf\n", res);
  return 0;
}
