<|instruction|>
Solve the below problem. The solution should start with an abridged problem statement. Then key observations. Then full solution based on the observations. Then C++ and Python implementations with comments.

417. Heavy Disc
Time limit per test: 0.5 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard



Consider a heavy disc on the plane, centered at (x0,y0) with radius r, with the origin strictly outside it. The density of the disc is given by formula

p(x,y) = ln(x^2+y^2)

What is the mass of the disc?

Input
The input file contains three integer numbers x0, y0, r (-100 ≤ x0, y0 ≤ 100, 1 ≤ r ≤ 100).

Output
Output one real number — the mass of the disc. Your answer will be considered correct if it is within 10-12 relative error of the exact answer.

Example(s)
sample input
sample output
3 4 2
40.449586576894895

<|response|>
1. Abridged Problem Statement
   Given a disc of radius r centered at (x0, y0) on the plane, with the origin strictly outside the disc (i.e., sqrt(x0²+y0²) > r). The material density at a point (x,y) is p(x,y) = ln(x²+y²). Compute the total mass
     M = ∬_{(x–x0)²+(y–y0)² ≤ r²} ln(x²+y²) dx dy
   and output it with relative error up to 1e–12.

2. Key Observations
   • Let s = sqrt(x0² + y0²). Since s > r, for any point in the disc the distance to the origin is never zero.
   • Shift to polar coordinates (D, θ) around the disc's center:
       x = x0 + D cosθ,
       y = y0 + D sinθ,
       D ∈ [0, r], θ ∈ [0, 2π).
     Then the area element dx dy = D dD dθ.
   • In these coordinates, x² + y² = s² + D² + 2 s D cosθ.
   • We need I(D) = ∫₀^{2π} ln(s² + D² + 2 s D cosθ) dθ. A standard result for A > |B| is
       ∫₀^{2π} ln(A + B cosθ) dθ = 2π · ln((A + sqrt(A² – B²))/2).
     Here A = s² + D², B = 2 s D, so sqrt(A² – B²) = s² – D² and
       (A + sqrt(A² – B²))/2 = s².
     Hence I(D) = 2π ln(s²), independent of D.

3. Full Solution Approach
   1. Compute s² = x0² + y0².
   2. Write the mass integral in shifted polar form:
        M = ∫_{θ=0..2π} ∫_{D=0..r} D · ln(s² + D² + 2 s D cosθ) dD dθ.
   3. Swap integrals and evaluate the θ–integral first using the formula above:
        ∫₀^{2π} ln(s² + D² + 2 s D cosθ) dθ = 2π ln(s²).
   4. Then
        M = ∫₀^r D · [2π ln(s²)] dD
          = 2π ln(s²) · ∫₀^r D dD
          = 2π ln(s²) · (r²/2)
          = π r² ln(s²).
   5. Since ln(s²) = 2 ln(s), one may also write M = 2 π r² ln(s), but π r² ln(x0² + y0²) is simplest.

   Final formula:
     M = π · r² · ln(x0² + y0²)

4. C++ Implementation with Detailed Comments
```cpp
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

const double pi = acos(-1);

double x, y, r;

void read() { cin >> x >> y >> r; }

void solve() {
    // Compute the mass of a disc centered at (x0, y0) with radius r, density
    // ln(x^2 + y^2). The origin is outside the disc, so s = sqrt(x0^2 + y0^2) >
    // r. The mass is the integral:
    //
    //     M = \int_{x,y \in D} \ln(x^2 + y^2) dx dy
    //
    // Use polar coordinates centered at (x0, y0). A point in the disc is:
    //
    //     x = x0 + D * cos(theta), y = y0 + D * sin(theta), 0 <= D <= r, 0 <=
    //     theta < 2pi.
    //
    // Then, x^2 + y^2 = s^2 + D^2 + 2sD * cos(theta).
    // The integral becomes:
    //
    //     M = \int_{theta=0}^{2pi} \int_{D=0}^r D * \ln(s^2 + D^2 + 2sD *
    //     cos(theta)) dD dtheta
    //
    // Integrate over theta first. For fixed D, let a = s^2 + D^2, b = 2sD.
    // Since s > r >= D:
    //
    //     \int_{0}^{2pi} \ln(a + b * cos(theta)) dtheta = 2pi * \ln(s^2).
    //
    // Thus, the mass is:
    //
    //     M = \int_{0}^r D * 2pi * \ln(s^2) dD = 2pi * \ln(s^2) * (r^2 / 2) =
    //     pi * r^2 * \ln(x0^2 + y0^2).

    double ans = pi * r * r * log(x * x + y * y);
    cout << setprecision(12) << fixed << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}
```

5. Python Implementation with Detailed Comments
```python
import math
import sys

def main():
    # Read three numbers from stdin: x0, y0, r
    data = sys.stdin.read().strip().split()
    x0, y0, r = map(int, data)

    # Squared distance from origin to the disc center
    s2 = x0*x0 + y0*y0

    # Closed-form result for the mass:
    #   M = π * r^2 * ln(s2)
    mass = math.pi * (r**2) * math.log(s2)

    # Print with 12 decimal places
    print("{:.12f}".format(mass))

if __name__ == "__main__":
    main()
```
