#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <iostream>
#include <cstring>

using namespace std;

const long double eps = 1e-8;
const long double pi = acos(-1.0);
const int maxn = 4e4 + 100;
long double am;
int n;
int dcmp(long double x){
	return x < -eps? -1 : x > eps;
}

long double sqr(long double x){
	return x * x;
}

struct point{
	long double x, y;
	point(long double x = 0, long double y = 0):x(x),y(y){}
	void read(){
		scanf("%Lf%Lf",&x,&y);
	}
	point operator + (const point &b){
		return point(x + b.x, y + b.y);
	}
	point operator - (const point &b){
		return point(x - b.x, y - b.y);
	}
	point operator * (long double a){
		return point(x * a, y * a);
	}
	point operator / (long double a){
		return point(x / a, y / a);
	}
	bool operator == (const point &b){
		return dcmp(x - b.x)==0 && dcmp(y - b.y)==0;
	}
	
};

point a[maxn],b[maxn];
point a1[maxn],b1[maxn];
long double arclen[maxn];
long double vmax[maxn],vc[maxn];
long double r[maxn];
long double angle[maxn];

long double dot(point a, point b){
	return a.x*b.x + a.y*b.y;
}
long double len2(point a){
	return dot(a,a);
}
long double len(point a){
	return sqrt(len2(a));
}
long double cross(point a, point b){
	return a.x*b.y - a.y*b.x;
}
point getlineinter(point p, point v, point q, point w){
	point u = p - q;
	long double t = cross(w,u) / cross(v,w);
	return p + v*t;
}
point rotate(point a){
	return point (-a.y, a.x);
}
bool rightside(point a1, point b1, point a2){
	point v1 = b1 - a1;
	point v2 = a2 - a1;
	if (cross(v2,v1) > 0)return 1;
	else return 0;
}
pair<long double, long double> gettime(long double len, long double v1, long double v2)
{
	if (dcmp(2*am*len + sqr(v1) - sqr(v2)) <= 0){
		long double v = sqrt(2*am*len + sqr(v1));
		long double t = (v - v1)/am;
		return make_pair(v,t);
	}
	if (dcmp(2*am*len + sqr(v2) - sqr(v1)) == 0)return make_pair(v2, (v1 - v2)/am);
	long double v = sqrt(am*len + (sqr(v1) + sqr(v2))/2);
	long double t = (2*v - v1 - v2)/am;
	//cout<<"@@"<<endl;
	return make_pair(v2,t);
}

void work(int i, int j)
{
	point v1 = rotate(b[i] - a[i]);
	point v2 = rotate(b[j] - a[j]);
	point c;
	if (dcmp(cross(v1,v2))==0){
		c = (b[i] + a[j])/2;
	}else{	
	c = getlineinter(b[i], v1, a[j], v2);
	}
	r[i] = len(c - b[i]);
	
	//cout<<r[i]<<endl;

	v1 = b[i] - a[i];
	v2 = b[j] - a[j];
	long double a2 = atan2(v2.y, v2.x);
	long double a1 = atan2(v1.y, v1.x);
	long double tmp = a2 - a1;
	if (tmp < 0)tmp += 2 * pi;
	if (rightside(a[i],b[i], a[j]))
		tmp = 2 * pi - tmp;
	angle[i] = tmp;
	//r[i] = fabs(len(b[i] - a[j])/2/sin(angle[i]/2));
	vc[i] = sqrt(am * r[i]);
	
	
}
long double gettime2(long double v, long double angle, long double r)
{
	return (r * angle)/v;	
}

int main()
{
	scanf("%d%Lf",&n,&am);
	for (int i = 0; i < n; ++i)
	{
		a1[i].read();
		b1[i].read();
	}
	int rear = 1;
	a[0] = a1[0];
	b[0] = b1[0];	
	for (int i = 1; i < n; ++i)
	if(b[rear] == a1[i]){
		b[rear] = b1[i];
	}else{
		a[rear] = a1[i];
		b[rear++] = b1[i];
	}
	n = rear;
	
	for (int i = 0; i < n-1; ++i)
	{
		work(i,i+1);
	}	
	vmax[n-1] = 0;
	for (int i = n - 2; i >= 0; --i)
	{
		vmax[i] = min(vc[i], sqrt(2 * am * len(b[i+1] - a[i+1]) + sqr(vmax[i+1])));	
		//cout<<i<<":"<<vmax[i]<<endl;	
	}
	long double ans = 0;
	long double cur = 0;
	for (int i = 0; i < n; ++i)
	{
		//
		pair<long double, long double> tmp = gettime(len(b[i] - a[i]), cur, vmax[i]);
		cur = tmp.first;
		//cout<<"cur:"<<cur<<endl;
		ans += tmp.second;
		//cout<<tmp.second<<endl;
		if (i != n-1){
			long double ttt = gettime2(cur, angle[i],r[i]);
			//cout<<"time2:"<<ttt<<endl;
			//cout<<"angle:"<<angle[i]<<endl;
			ans += gettime2(cur, angle[i],r[i]);
		}		
		//cout<<"###"<<ans<<endl;
	}
	printf("%.12Lf\n",ans);
	
	return 0;
}

Measured memory_bytes: 9408