/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in = new Scanner( System.in);
    double p1x, p1y, p2x, p2y; //point
    double x, y; //intersection points
    double cx, cy, r; //circle

    System.out.print("Enter cx: ");
    cx = in.nextDouble();
    System.out.print("Enter cy: ");
    cy = in.nextDouble();
    System.out.print("Enter r: ");
    r = in.nextDouble();
    System.out.print("Enter p1x: ");
    p1x = in.nextDouble();
    System.out.print("Enter p1y: ");
    p1y = in.nextDouble();
    System.out.print("Enter p2x: ");
    p2x = in.nextDouble();
    System.out.print("Enter p2y: ");
    p2y = in.nextDouble();
    
    if(p2x == p1x){
    	//line is vertical, or both points are in the same position.
    	double dx = p2x - cx;
    	if(dx*dx<r*r){
    		//infinite line hits circle check y values.
    		
    	} else{
    		System.out.println("doesn't touch.");
    	}
    } else{
    
        double m = (p2y - p1y)/(p2x - p1x);
    
        double b = p1y - m*p1x;
    
        double B = (b - m*cx-cy);
        if((r*r*(m*m+1))>B*B){
    	    //inifinite line hits the circle. Now to solve the actual x positions.
    	    double radical = Math.sqrt((m*m+1)*r*r - B*B);
    	    double x0 = cx + (-m*B + radical)/(m*m+1);
    	    double x1 = cx + (-m*B - radical)/(m*m+1);
    	    System.out.println("infinite line touches at: " + x0 + ", and " + x1);
            //finaly check if either x0 or x1 are between p1x and p2x.
            if((x0>p1x&&x0<p2x)||(x0>p2x&&x0<p1x)||(x1>p1x&&x1<p2x)||(x1>p2x&&x1<p1x)){
            	System.out.println("line segment touches");
            }
        } else{
    	    System.out.println("doesn't touch");
        }
    }
	}
}