import sys # sys.setrecursionlimit(200005) # sys.set_int_max_str_digits(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] # inf = -1-(-1 << 31) inf = -1-(-1 << 63) # md = 10**9+7 md = 998244353 def norm(i,j): x,y=xy[i] s,t=xy[j] return ((x-s)**2+(y-t)**2)**0.5 def ok(i,j): for k in range(n): if cross(i,j,k):return False return True def cross(i,j,k): x,y=xy[i] s,t=xy[j] a,b=xy[k*2] c,d=xy[k*2+1] if ((c-x)*(t-y)-(d-y)*(s-x))*((s-x)*(b-y)-(t-y)*(a-x))<=0:return False if ((x-a)*(d-b)-(y-b)*(c-a))*((c-a)*(t-b)-(d-b)*(s-a))<=0:return False return True n,m=LI() n2=n*2 xy=[None]*n2 for i in range(n): x,y,s,t=LI() xy[i*2]=(x,y) xy[i*2+1]=(s,t) dist=[inf]*(n2*n2) for i in range(n2): for j in range(i+1): if i==j: dist[i*n2+j]=0 elif ok(i,j): dist[i*n2+j]=dist[j*n2+i]=norm(i,j) for j in range(n2): for i in range(n2): for k in range(i): d=dist[i*n2+j]+dist[j*n2+k] if d