// Arup Guha
// 1/7/2020
// Alternate Solution for 2021 Proposed NAQ Problem: Drawing Cycles

import java.util.*;

public class drawingcycles_arup {

	public static int n;
	public static circle[] list;

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();
		list = new circle[n];
		
		// Read in all of the circles.
		for (int i=0; i<n; i++) {
			int x = stdin.nextInt();
			int y = stdin.nextInt();
			int r = stdin.nextInt();
			list[i] = new circle(x, y, r);
		}
		
		double res = 0;
		
		// Not necessary but I consider the circles in reverse order.
		for (int i=n-1; i>=0; i--) {
			
			// This will store each occlusion event of circle i.
			ArrayList<event> eList = new ArrayList<event>();
			
			// Will store if this circle ever gets fully covered by another.
			boolean covered = false;
			
			// Now add in each occlusion event.
			for (int j=i+1; j<n; j++) {
				
				// This circle gets completely erased...
				if (list[i].coveredBy(list[j])) {
					covered = true;
					break;
				}
				
				// Other way around, ours is bigger and stays.
				if (list[j].coveredBy(list[i]) && list[j].r < list[i].r) continue;
				
				// Get the intersection.
				double[] where = list[i].ptsIntersect(list[j]);
				
				// None to consider.
				if (where == null) continue;
				
				// Range wraps around the angle Math.PI.
				if (where[0] > where[1]) {
					
					// One event till end of angle range.
					eList.add(new event(where[0],1));
					eList.add(new event(Math.PI, -1));
					
					// A second event from beginning of whole range to the end of this range.
					eList.add(new event(-Math.PI, 1));
					eList.add(new event(where[1], -1));
				}
				
				// Regular range.
				else {
					eList.add(new event(where[0], 1));
					eList.add(new event(where[1], -1));
				}
			}
			
			// None of this circle is visible at the end.
			if (covered) continue;
			
			// Find the angle range that is covered.
			Collections.sort(eList);
			double rangeOff = getRangeOff(eList);
			
			// This is the part of the cirlce visible at the end.
			res += list[i].r*(2*Math.PI-rangeOff);
		}
		
		// Ta da!
		System.out.print(res);
		System.out.print("\n");
	}
	
	// Returns the amount of the intervals that are on in list.
	public static double getRangeOff(ArrayList<event> list) {
		
		// Nothing is occluded.
		if (list.size() == 0) return 0;
		
		// This will store when we last turned on.
		double lastOn = list.get(0).a;
		int numOn = 1;
		double res = 0;
		
		// Go through the rest of the events.
		for (int i=1; i<list.size(); i++) {
			
			// Updating the number of events on.
			numOn += list.get(i).count;
			
			// Interval has closed, add it.
			if (numOn == 0) res += (list.get(i).a - lastOn);
			
			// Only happens when we go from closed to open.
			else if (numOn == 1 && list.get(i).count == 1) lastOn = list.get(i).a;
		}
		
		// This is the desired sum.
		return res;
	}
}

class circle {

	public int x;
	public int y;
	public int r;
	
	public circle(int myx, int myy, int myr) {
		x = myx;
		y = myy;
		r = myr;
	}
	
	public int distSq(circle other) {
		return (x-other.x)*(x-other.x) + (y-other.y)*(y-other.y);
	}
	
	public boolean coveredBy(circle other) {
		return other.r >= r && distSq(other) <= (other.r - r)*(other.r-r);
	}
	
	// Pre-condition: other doesn't completely cover this circle.
	// Post-condition: returns the range of this circle that is covered by other,
	//                 via two values as measured by atan2.
	public double[] ptsIntersect(circle other) {
		
		int dSq = distSq(other);
		
		// Tangent circles don't affect us, so we care only if there is overlap.
		if ((other.r+r)*(other.r+r) <= dSq)
			return null;
		
		// Direction from this circle towards other.
		double midAngle = Math.atan2(other.y-y, other.x-x);
		
		// This is the angle formed by this radius, and the line segment connecting the
		// centers of the circle, calculated via law of cosines.
		double angleUp = Math.acos((r*r + dSq - other.r*other.r)/(2*r*Math.sqrt(dSq)));
		
		// Get the two critical angles.
		double[] res = new double[2];
		res[0] = midAngle-angleUp;
		res[1] = midAngle+angleUp;
		
		// Map into range of atan2.
		if (res[0] < -Math.PI) res[0] += 2*Math.PI;
		if (res[1] > Math.PI) res[1] -= 2*Math.PI;
		
		// This is the desired range.
		return res;
	}
}

class event implements Comparable<event> {
	
	public double a;
	public int count;
	
	public event(double when, int type) {
		a = when;
		count = type;
	}
	
	public int compareTo(event other) {
		
		// First sort by the interval location.
		if (Double.compare(a, other.a) != 0) return Double.compare(a, other.a);
		
		// Here we have open intervals coming first.
		return other.count - count;
	}
}