import java.util.Scanner;
class Point {
double x, y;
Point(double A, double B) {
x = A;
y = B;
}
}
class Line {
Point point_A, point_B;
Line(Point A, Point B) {
point_A = A;
point_B = B;
}
}
class Circle {
Point O;
int r;
Circle(Point A, int B) {
O = A;
r = B;
}
}
public class Main {
public static double getDistance(Circle circle, Line l) {
double A = l.point_B.y - l.point_A.y;
double B = l.point_A.x - l.point_B.x;
double C = -B * l.point_A.y + l.point_A.x * (-A);
double temp = Math.pow(A, 2) + Math.pow(B, 2);
double lower = Math.pow(temp, 0.5);
temp = A * circle.O.x + B * circle.O.y + C;
double upper = Math.abs(temp);
double d = upper/lower;
double ab05 = circle.r*circle.r-d*d;
return 2*Math.pow(ab05,0.5);
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double ox = scanner.nextDouble();
double oy = scanner.nextDouble();
int r = scanner.nextInt();
double x1 = scanner.nextDouble();
double y1 = scanner.nextDouble();
double x2 = scanner.nextDouble();
double y2 = scanner.nextDouble();
Point center = new Point(ox, oy);
Circle circle = new Circle(center, r);
Point p1 = new Point(x1, y1);
Point p2 = new Point(x2, y2);
Line l = new Line(p1, p2);
double result = getDistance(circle, l);
System.out.printf("%.6f\n", result);
scanner.close();
}
}