#include <bits/stdc++.h>
#include <cmath>
#include <math.h>
using namespace std;

struct point{
    double x,y;
    point(double A,double B){
        x=A,y=B;
    }
    point() = default;
};

struct line{
    point point_A,point_B;
    line(point A,point B){
        point_A = A,point_B = B;
    }
    line() = default;
};

struct Circle{
    point O;
    int r;
    Circle(point A,int B){
        O=A,r=B;
    }
    Circle() = default;
};

double getDistance(const Circle& circle, const line& l) {
    // 请在这里实现你的代码
    // 先求点到直线的距离,然后用勾股定理得到
    double d = abs( (l.point_A.x-circle.O.x)*(l.point_B.y-circle.O.y) - (l.point_B.x-circle.O.x)*(l.point_A.y-circle.O.y) ) / sqrt( pow(l.point_A.x - l.point_B.x,2) + pow(l.point_A.y - l.point_B.y,2) );
    return 2*sqrt(circle.r*circle.r-d*d);
}

int main() {
    double ox, oy, r;
    double x1, y1, x2, y2;
    
    cin >> ox >> oy >> r;
    cin >> x1 >> y1 >> x2 >> y2;
    
    point center(ox, oy);
    Circle circle(center, (int)r);
    
    point p1(x1, y1);
    point p2(x2, y2);
    line l(p1, p2);
    
    double result = getDistance(circle, l);
    cout << fixed << setprecision(6) << result << endl;
    
    return 0;
}