#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef long double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos((R)(-1));

/*
 -1 -> neg
  0 -> near 0
  1 -> pos
  */
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}

/*
 -1 -> a > b
 0 -> a near b
 1 -> a < b
 */
int sgn(R a, R b) {
    return sgn(b-a);
}

bool near(P a, P b) {
    return !sgn(abs(a-b));
}

bool lessP(const P &l, const P &r) {
    if (sgn(l.real(), r.real())) return l.real() < r.real();
    if (sgn(l.imag(), r.imag())) return l.imag() < r.imag();
    return false;
}

R cross(P a, P b) { return a.real()*b.imag() - a.imag()*b.real(); }
R dot(P a, P b) { return a.real()*b.real() + a.imag()*b.imag(); }

/* 1->cclock
  -1->clock
   0->on
   2->back
  -2->front
  */
int ccw(P a, P b, P c) {
    assert(!near(a, b));
    if (near(a, c) || near(b, c)) return 0;
    int s = sgn(cross(b-a, c-a));
    if (s) return s;
    if (dot(b-a, c-a) < 0) return 2;
    if (dot(a-b, c-b) < 0) return -2;
    return 0;
}

R ssqrt(R d) {
    d = max<R>(0, d);
    return sqrt(d);
}

R sacos(R d) {
    d = max<R>(-1, d);
    d = min<R>(1, d);
    return acos(d);
}

struct L {
    P x, y;
    L() {};
    L(P x, P y) :x(x), y(y) {};
};

P vec(const L &l) {
    return l.y - l.x;
}

R abs(const L &l) {
    return abs(vec(l));
}

//??????????????¢??????
R deg2rad(R x) {
    return x/180*PI;
}

//????????¢????????????
R rad2deg(R x) {
    return x/PI*180;
}

//?§???????[0, 2*PI)???
R radNorP(R x) {
    return fmod(fmod(x, 2*PI) + 2*PI, 2*PI);
}

//?§???????[-PI, PI)???
R radNorN(R x) {
    x = radNorP(x);
    if (x >= PI) x -= 2*PI;
    return x;
}

/**
 * radian??§???x???[l, r]?????\??£????????????????????\??????
 * 0:OFF
 * 1:IN
 * 2:ON
 */
bool inR(R l, R r, R x) {
    l = radNorP(l);
    r = radNorP(r);
    x = radNorP(x);
    if (!sgn(l, x) || !sgn(r, x)) return 2;
    if (!sgn(l, r)) return 0;
    if (sgn(l, r) == 1) {
        if (sgn(l, x) == 1 && sgn(x, r) == 1) return 1;
    } else {
        if (sgn(x, r) == 1 || sgn(l, x) == 1) return 1;
    }
    return 0;
}


struct C {
    P p;
    R r;
    C() {}
    C(P p, R r) : p(p), r(r) {}
};

//return number of cross point
int crossCC(const C &c, const C &d, R &l, R &r) {
    if (near(c.p, d.p) && !sgn(c.r, d.r)) {
        assert(false);
        return -1;
    }
    R di = abs(c.p - d.p);
    if (sgn(c.r+d.r, di) == 1) return 0;
    if (sgn(di, abs(c.r-d.r)) == 1) return 0;
    R bth = arg(d.p - c.p);
    R th = sacos((c.r*c.r + di*di - d.r*d.r) / (2*c.r*di));
    l = bth-th;
    r = bth+th;
    if (sgn(th) == 0) return 1;
    return 2;
}

C c[110];

typedef pair<R, int> Pi;

bool solve() {
    int n;
    cin >> n;
    if (!n) return false;
    for (int i = 0; i < n; i++) {
        R x, y, r;
        cin >> x >> y >> r;
        c[i] = C(P(x, y), r);
    }
    R result = 0;
    for (int i = 0; i < n; i++) {
        bool f = false;
        vector<Pi> v;
        for (int j = 0; j < n; j++) {
            if (i == j) continue;
            if (sgn(c[i].r+abs(c[i].p-c[j].p), c[j].r) != -1) {
                f = true;
                break;
            }
            R l, r;
            if (crossCC(c[i], c[j], l, r)) {
                l = radNorP(l);
                r = radNorP(r);
//                printf("debug %d %d %Lf %Lf\n", i, j, l, r);
                if (sgn(r, l) == 1) {
                    v.push_back(Pi(0, 1));
                    v.push_back(Pi(r, -1));
                    v.push_back(Pi(l, 1));
                    v.push_back(Pi(2*PI, -1));
                } else {
                    v.push_back(Pi(l, 1));
                    v.push_back(Pi(r, -1));
                }
            }
        }
        if (f) continue;
        sort(v.begin(), v.end());
        R ba = 0, re = 0;
        int sm = 0;
        for (Pi p: v) {
//            printf("sousa %Lf %d\n", p.first, p.second);
            if (!sm) {
                re += p.first-ba;
            }
            ba = p.first;
            sm += p.second;
        }
        re += 2*PI-ba;
//        printf("res %Lf\n", re);
        result += c[i].r*re;
    }
    printf("%.20Lf\n", result);
    return true;
}


int main() {
    while (solve()) {}
    return 0;
}

Measured memory_bytes: 1260