#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;

const int N = 40000 + 10;
const double eps = 1e-8;
const double PI = acos(-1.0);

int sgn(double x)
{
	if (x < -eps) return -1;
	if (x > eps) return 1;
	return 0;
}

double dbl(double x)
{
	return x * x;
}

struct Point {
	double x, y;
	Point() {}
	Point(const double _x, const double _y) {
		x = _x, y = _y;
	}
	friend Point operator + (const Point &a, const Point &b) {
		return Point(a.x + b.x, a.y + b.y);
	}
	friend Point operator - (const Point &a, const Point &b) {
		return Point(a.x - b.x, a.y - b.y);
	}
	friend Point operator * (const Point &a, const double k) {
		return Point(a.x * k, a.y * k);
	}
	friend Point operator / (const Point &a, const double k) {
		return Point(a.x / k, a.y / k);
	}
	friend double dot(const Point &a, const Point &b) {
		return (a.x * b.x + a.y * b.y);
	}
	friend double det(const Point &a, const Point &b) {
		return (a.x * b.y - a.y * b.x);
	}
	friend double len(const Point &a) {
		return sqrt(a.x * a.x + a.y * a.y);
	}
	void read() {
		cin >> x >> y;
	}
	void write() const {
		cout << x << " " << y << endl;
	}
};

struct Seg {
	Point u, v, w;
	double dist;
	Seg() {}
	Seg(const Point &_u, const Point &_v) {
		u = _u, v = _v;
	}
	void read() {
		u.read();
		v.read();
	}
	void prepare() {
		w = v - u;
		w = Point(-w.y, w.x);
		dist = len(v - u);
	}
} seg[N];

bool intersect(const Point &a, const Point &b, const Point &c, const Point &d, Point &e)
{
	double s1 = det(c - a, d - a);
	double s2 = det(d - b, c - b);
	if (!sgn(s1 + s2)) return false;
	e = (b - a) * (s1 / (s1 + s2)) + a;
	return true;
}

double rectify(double x)
{
	while (x < -eps) x += 2 * PI;
	while (x > 2 * PI + eps) x -= 2 * PI;
	return x;
}

int n;
Point center[N];
double amax, radius[N], angle[N], vmax[N][2];

double calc(double vstart, double vend, double dist)
{
	double vm = sqrt((2 * amax * dist + dbl(vstart) + dbl(vend)) / 2.0);
	double ret = (2 * vm - vstart - vend) / amax;
	return ret;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> amax;
	for (int i = 1; i <= n; ++i) {
		seg[i].read();
		seg[i].prepare();
	}
	for (int i = 1; i < n; ++i) {
		static Point u, v;
		static double ang1, ang2;
		
		bool ret = intersect(seg[i].v, seg[i].v + seg[i].w, seg[i + 1].u, seg[i + 1].u + seg[i + 1].w, center[i]);
		if (!ret) center[i] = (seg[i].v + seg[i + 1].u) / 2.0;

		radius[i] = len(seg[i].v - center[i]);
		u = seg[i].v - center[i];
		v = seg[i + 1].u - center[i];
		ang1 = atan2(u.y, u.x);
		ang2 = atan2(v.y, v.x);
		if (sgn(det(seg[i].v - center[i], seg[i].v - seg[i].u)) > 0) {
			angle[i] = rectify(ang2 - ang1);
		} else {
			angle[i] = rectify(ang1 - ang2);
		}
	}
	/*
	for (int i = 1; i < n; ++i) {
		cout << center[i].x << " " << center[i].y << " " << angle[i] << endl;
	}
	*/
	vmax[n][1] = 0.0;
	vmax[n][0] = sqrt(2 * amax * seg[n].dist);
	
	for (int i = n - 1; i >= 1; --i) {
		vmax[i][1] = min(vmax[i + 1][0], sqrt(amax * radius[i]));
		vmax[i][0] = sqrt(dbl(vmax[i][1]) + 2 * amax * seg[i].dist);
	}

	double times = 0;
	double v = 0;

	for (int i = 1; i <= n; ++i) {
		if (v > vmax[i][1]) {
			times += calc(v, vmax[i][1], seg[i].dist);
			v = vmax[i][1];
		} else {
			if (dbl(v) + 2 * amax * seg[i].dist <= dbl(vmax[i][1])) {
				times += (sqrt(dbl(v) + 2 * amax * seg[i].dist) - v) / amax;
				v = sqrt(dbl(v) + 2 * amax * seg[i].dist);
			} else {
				times += calc(v, vmax[i][1], seg[i].dist);
				v = vmax[i][1];
			}
		}
		if (i < n) {
			times += radius[i] * angle[i] / v;
		}
	}

	cout << setiosflags(ios::fixed) << setprecision(8) << times << endl;
	
	return 0;
}

Measured memory_bytes: 5384