Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of r meters (this range can be chosen by Fifa) from its position. Fifa must put the access point inside the flat which has a circular shape of radius R. Fifa wants to minimize the area that is not covered by the access point inside the flat without letting Fafa or anyone outside the flat to get access to the internet.

The world is represented as an infinite 2D plane. The flat is centered at (x_1, y_1) and has radius R and Fafa's laptop is located at (x_2, y_2), not necessarily inside the flat. Find the position and the radius chosen by Fifa for his access point which minimizes the uncovered area.


-----Input-----

The single line of the input contains 5 space-separated integers R, x_1, y_1, x_2, y_2 (1 ≤ R ≤ 10^5, |x_1|, |y_1|, |x_2|, |y_2| ≤ 10^5).


-----Output-----

Print three space-separated numbers x_{ap}, y_{ap}, r where (x_{ap}, y_{ap}) is the position which Fifa chose for the access point and r is the radius of its range. 

Your answer will be considered correct if the radius does not differ from optimal more than 10^{ - 6} absolutely or relatively, and also the radius you printed can be changed by no more than 10^{ - 6} (absolutely or relatively) in such a way that all points outside the flat and Fafa's laptop position are outside circle of the access point range.


-----Examples-----
Input
5 3 3 1 1

Output
3.7677669529663684 3.7677669529663684 3.914213562373095

Input
10 5 5 5 15

Output
5.0 5.0 10.0

Difficulty: interview

Starter code:

Solutions:
import sys

R,x,y,s,t = list(map(int,input().split()))

if (s-x)**2 + (t-y)**2 > R*R:
    print(x,y,R)
    return

dx = x - s
dy = y - t
r = (dx**2 + dy**2)**.5

if abs(r)<1e-9:
    dx = 1
    dy = 0
else:
    dx /= r
    dy /= r

a = s + dx*(R + r)/2
b = t + dy*(R + r)/2

print(a,b,(R+r)/2)



import sys, math

#f = open('input/input_0', 'r')
f = sys.stdin

R, x1, y1, x2, y2 = list(map(int, f.readline().split()))

dx = x1 - x2
dy = y1 - y2
if dx**2 + dy**2 >= R**2:
  print(x1, y1, R)
elif dx == 0 and dy == 0:
  print(x1+R/2, y1, R/2)
else:
  dl = (dx**2 + dy**2) ** 0.5
  r = (dl + R) / 2
  ax = x2 + dx / dl * r
  ay = y2 + dy / dl * r
  print(ax, ay, r)


def dist2(x1,y1,x2,y2):
    return (x1-x2)**2+(y1-y2)**2
R,x1,y1,x2,y2 = list(map(int,input().split()))
if dist2(x1,y1,x2,y2) >= R**2:
    print(x1,y1,R)
else:
    d2 = dist2(x1,y1,x2,y2)
    if abs(d2)<0.0000000001:
        x = x1+R/2
        y = y1
        print(x,y,R/2)
    else:
        dd = d2**0.5+R
        dd /= 2
        x = x2+dd*(x1-x2)/(d2**0.5)
        y = y2+dd*(y1-y2)/(d2**0.5)
        print(x,y,dd)


def main():
    R, x1, y1, x2, y2 = list(map(int, input().split()))

    if (x1 - x2) ** 2 + (y1 - y2) ** 2 >= R ** 2:
        return x1, y1, R

    if x1 == x2 and y1 == y2:
        return x1 + 0.5 * R, y1, 0.5 * R

    vx = x1 - x2
    vy = y1 - y2
    vnorm = (vx**2 + vy**2) ** 0.5
    r = R / vnorm

    return (0.5 * (x1 + x2 + vx * r),
            0.5 * (y1 + y2 + vy * r),
            0.5 * (R + vnorm))


def __starting_point():
    x, y, R = main()
    print(x, y, R)

__starting_point()

import math

R, x1, y1, x2, y2 = list(map(int, input().split()))

v = [x1 - x2, y1 - y2]

if v != [0, 0]:
    lv = math.hypot(v[0], v[1])
    if lv <= R:
        sf = ((lv + R) / lv) / 2
        vs = [v[0] * sf, v[1] * sf]

        r = math.hypot(vs[0] - x2, vs[1] - y2)

        print(x2 + vs[0], y2 + vs[1], (lv + R) / 2)
    else:
        print(x1, y1, R)
else:
    print(x1 + R / 2, y1, R / 2)


import math as mt
import itertools as it
import functools as ft
import random as rnd

stdin = lambda type_ = "int", sep = " ": list(map(eval(type_), input().split(sep)))
joint = lambda sep = " ", *args: sep.join(str(i) if type(i) != list else sep.join(map(str, i)) for i in args)

R, x1, y1, x2, y2 = stdin()

if x1 == x2 and y1 == y2:
    print("{} {} {}".format(x1 + (R / 2.), y1, R / 2.))
elif (x2 - x1) ** 2 + (y2 - y1) ** 2 >= R ** 2:
    print('{} {} {}'.format(x1, y1, R))
else:
    dist = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    tochka = [x2 + (x1 - x2) * (dist + R) / dist, y2 + (y1 - y2) * (dist + R) / dist]
    print("{} {} {}".format((tochka[0] + x2) / 2, (tochka[1] + y2) / 2, (((tochka[0] - x2) ** 2 + (tochka[1] - y2) ** 2 ) ** 0.5) / 2))


import math

r,x1,y1,x2,y2=input().split()
r,x1,y1,x2,y2=float(r),float(x1),float(y1),float(x2),float(y2)

d=math.sqrt((x2-x1)**2+(y2-y1)**2)

if d>r:
	print(x1,y1,r)
elif d==0:
	print(x1+r/2,y1,r/2)
else:
	R=(r+d)/2

	dist=(r-d)/2

	X=x1-(x2-x1)/d*dist
	Y=y1-(y2-y1)/d*dist

	print(X,Y,R)


R,x1,y1,x2,y2=input().split()
R=float(R)
x1=float(x1)
y1=float(y1)
x2=float(x2)
y2=float(y2)
d=((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))**0.5
k1=d;
k2=(R-d)/2;
if d==0:
	print(x1+R/2,y1,R/2)
elif d<=R:
	print((x1*(k1+k2)-k2*x2)/k1,(y1*(k1+k2)-k2*y2)/k1,(R+d)/2)
else:
	print(x1,y1,R)


from math import hypot, sqrt

R, x1, y1, x2, y2 = list(map(int, input().split()))

if hypot(x1 - x2, y1 - y2) > R:
    print(x1, y1, R)

elif (x1, y1) == (x2, y2):
    print(x1 + R / 2, y1, R / 2)

else:
    A = y2 - y1
    B = x1 - x2
    C = -x1 * (y2 - y1) + y1 * (x2 - x1)

    if A != 0:
        A1 = A ** 2 + B ** 2
        B1 = 2 * (B * C + A * B * x1 - A ** 2 * y1)
        C1 = A ** 2 * (x1 ** 2 + y1 ** 2 - R ** 2) + C ** 2 + 2 * A * C * x1

        D = B1 ** 2 - 4 * A1 * C1

        Y1 = (-B1 + sqrt(D)) / (2 * A1)
        Y2 = (-B1 - sqrt(D)) / (2 * A1)

        X1 = (-B * Y1 - C) / A
        X2 = (-B * Y2 - C) / A

        h1 = hypot(x2 - X1, y2 - Y1)
        h2 = hypot(x2 - X2, y2 - Y2)

        if h1 > h2:
            print((x2 + X1) / 2, (y2 + Y1) / 2, h1 / 2)

        else:
            print((x2 + X2) / 2, (y2 + Y2) / 2, h2 / 2)


    elif B != 0:
        A1 = A ** 2 + B ** 2
        B1 = 2 * (A * C + A * B * y1 - B ** 2 * x1)
        C1 = B ** 2 * (x1 ** 2 + y1 ** 2 - R ** 2) + C ** 2 + 2 * B * C * y1

        D = B1 ** 2 - 4 * A1 * C1

        X1 = (-B1 + sqrt(D)) / (2 * A1)
        X2 = (-B1 - sqrt(D)) / (2 * A1)

        Y1 = (-A * X1 - C) / B
        Y2 = (-A * X2 - C) / B

        h1 = hypot(x2 - X1, y2 - Y1)
        h2 = hypot(x2 - X2, y2 - Y2)

        if h1 > h2:
            print((x2 + X1) / 2, (y2 + Y1) / 2, h1 / 2)

        else:
            print((x2 + X2) / 2, (y2 + Y2) / 2, h2 / 2)

    else:
        exit(100500)


eps  = 0.00000000000001;
R, x1, y1, x2, y2 = map(int, input().split());
rst = ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) ** (1/2);
#print(rst);
if rst > R:
    print(x1, y1, R- eps);
else:
    of = rst;
    #print(R, of);
    r = (R + of) / 2;
    dx = x1 - x2;
    dy = y1 - y2;
    #print(dx, dy);
    if of != 0:
        dx1 = (1/2 + R /(2 * of)) * dx;
        dy1 = (1/2 + R / (2 * of)) * dy;
    else:
        dx1 = R / 2;
        dy1 = 0;
    #print(dx1, dy1);
    x = x2 + dx1;
    y = y2 + dy1;
    print(x, y, r - eps);

import math


class Vector:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __add__(self, other):
        return Vector(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return Vector(self.x - other.x, self.y - other.y)

    def __mul__(self, other):
        if str(type(other)) == "<class 'int'>" or str(type(other)) == "<class 'float'>":
            return Vector(self.x * other, self.y * other)
        else:
            return self.x * other.x + self.y * other.y

    def __truediv__(self, other):
        return Vector(self.x / other, self.y / other)

    def __xor__(self, other):
        return self.x * other.y - other.x * self.y

    def get_length(self):
        return math.sqrt(self.x ** 2 + self.y ** 2)

    def __str__(self):
        return str(self.x) + " " + str(self.y)

    def get_nor(self):
        l = self.get_length()
        if l == 0:
            l = 1
        return Vector(self.x / l, self.y / l)

    def rotate(self):
        return Vector(-self.x, -self.y)


r, x, y, x1, y1 = list(map(float, input().split()))
if (x - x1) ** 2 + (y - y1) ** 2 < r ** 2:
    if x1 == x and y1 == y:
        v1 = Vector(r, 0)
    else:
        v1 = Vector(x1 - x, y1 - y).get_nor() * r
    v2 = v1.rotate()
    xp1 = x + v1.x
    yp1 = y + v1.y
    xp2 = x + v2.x
    yp2 = y + v2.y
    if (xp1 - x1) ** 2 + (yp1 - y1) ** 2 < (xp2 - x1) ** 2 + (yp2 - y1) ** 2:
        xp1 = xp2
        yp1 = yp2
    v3 = Vector(xp1 - x1, yp1 - y1) / 2
    ax = x1 + v3.x
    ay = y1 + v3.y
    print(ax, ay, v3.get_length())
else:
    print(x, y, r)