import java.io.*; import java.util.*; public class spiro { private static final Scanner cin = new Scanner(System.in); public static void main(String[] args) { while(true) { int p = cin.nextInt(); int q = cin.nextInt(); int r = cin.nextInt(); if(p == 0 && q == 0 && r == 0) { break; } double l; if(r != 0) { l = new Integrator(p, q, r).integrate(); } else { l = 2.0 * Math.PI * (p - q); } System.out.println(String.format("%.8f", l)); } } private static class Integrator { private static int N = 1048576; private double a; private double b; private double m; private double T; public Integrator(int p, int q, int r) { double dp = p; double dq = q; double dr = r; double v1 = dp - dq; double v2 = v1 / dq * dr; a = v1 * v1 + v2 * v2; b = v1 * v2 * 2.0; m = dq / dp; T = dp / gcd(q, p - q) * 2.0 * Math.PI; } public double integrate() { double l = 0.0; for(long i = 0; i < N; i++) { double x1 = T * (i + 0) / N; double x2 = T * (i + 1) / N; double xm = (x1 + x2) / 2.0; l += Math.sqrt(a - b * Math.cos(x1)); l += Math.sqrt(a - b * Math.cos(xm)) * 4.0; l += Math.sqrt(a - b * Math.cos(x2)); } return l * m * T / (6 * N); } private static int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); } } }