#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <cassert>
using namespace std;
const double EPS = 1e-10;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
namespace std{
    bool operator < (const P& a, const P& b){
        return !EQ(a.X,b.X) ? a.X<b.X : a.Y+EPS<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}

bool intersectSS(const L& a, const L& b){
    return ( ccw(a[0],a[1],b[0]) *ccw(a[0],a[1],b[1]) <= 0 ) &&
        ( ccw(b[0],b[1],a[0]) *ccw(b[0],b[1],a[1]) <= 0 );
}

bool isParallel(const P &a, const P &b){
    return abs(cross(a,b)) < EPS;
}
bool isParallel(const L &a, const L &b){
    return isParallel(a[1]-a[0], b[1]-b[0]);
}
P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B/A *(m[1]-m[0]);
}

double getangle(P a, P b){
    return abs(arg(a/b));
}

int main(){
    int n;
    double amax;
    cin >> n >> amax;

    vector<L> l(n);
    vector<double> len(n);
    for(int i=0; i<n; i++){
        double xs,ys,xt,yt;
        cin >> xs >> ys >> xt >> yt;
        l[i] = L(P(xs, ys), P(xt, yt));
        len[i] = abs(l[i][1] -l[i][0]);
    }
    //i番目の線分の終点を通過するときの速度上限
    vector<double> vlimit(n);
    vlimit[n-1] = 0;
    vector<double> arclen(n-1);
    for(int i=n-2; i>=0; i--){
        double r;
        if(isParallel(l[i], l[i+1])){
            r = abs(l[i+1][0] -l[i][1]) /2.0;
            arclen[i] = PI *r;
        }else{
            //接合部分に向かう方向
            P dir[2] = {l[i][1] -l[i][0], l[i+1][0] -l[i+1][1]};    
            P ortdir[2] = {dir[0]*P(0, 1), dir[1]*P(0, 1)};
            L ortline[2] = {L(l[i][1], l[i][1] +ortdir[0]), L(l[i+1][0], l[i+1][0] +ortdir[1])};
            //円弧の中心
            P cp = crosspointLL(ortline[0], ortline[1]);
            r = abs(l[i][1] -cp);
            L ray[2] = {L(l[i][1], l[i][1] +1e4*dir[0]), L(l[i+1][0], l[i+1][0] +1e4*dir[1])};
            if(intersectSS(ray[0], ray[1])){
                arclen[i] = r *getangle(dir[0], dir[1]);
            }else{
                arclen[i] = r *(2*PI -getangle(dir[0], dir[1]));
            }
        }
        //カーブを曲がり切れる速度上限
        //a = v^2 /r より
        double v = sqrt(r *amax);
        //次以降のカーブを曲がり切れる速度上限
        //v^2 -(v_0)^2 = 2ax より
        double vrev = sqrt(2 *amax *len[i+1] +vlimit[i+1]*vlimit[i+1]);
        vlimit[i] = min(v, vrev);
    }

    double ans = 0;
    double v = 0;
    for(int i=0; i<n; i++){
        double clen = (vlimit[i]*vlimit[i] -v*v +2*amax*len[i]) /(4*amax);
        if(clen < 0 || len[i] < clen){
            //加減速のみ
            double acc = (vlimit[i] > v)? amax: -amax;
            double vend = sqrt(2 *acc *len[i] +v*v);
            ans += (vend -v) /acc;
            v = vend;
        }else{
            //加速のち減速
            double vmid = sqrt(2 *amax *clen +v*v);
            ans += (vmid -v) /amax + (vlimit[i] -vmid) /(-amax);
            v = vlimit[i];
        }
   
        //円運動中の時間を加算
        if(i < n-1){
            ans += arclen[i] /v;
        }
    }
    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5060