import java.io.*;
import java.util.*;
import java.math.*;

public class football_af_bug1 implements Runnable {
  public static void main(String[] args) {
    new Thread(new football_af_bug1()).start();
  }

  BufferedReader br;
  StringTokenizer st;
  PrintWriter out;
  boolean eof;

  public void run() {
    try {
      Locale.setDefault(Locale.US);
      br = new BufferedReader(new FileReader("football.in"));
      out = new PrintWriter("football.out");
      solve();
      out.close();
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(-1);
    }
  }

  String nextToken() {
    while (st == null || !st.hasMoreElements()) {
      try {
        st = new StringTokenizer(br.readLine());
      } catch (Exception e) {
        eof = true;
        return "0";
      }
    }
    return st.nextToken();
  }

  int nextInt() {
    return Integer.parseInt(nextToken());
  }

  long nextLong() {
    return Long.parseLong(nextToken());
  }

  void myAssert(boolean e, String msg) {
    if (!e) {
      throw new Error(msg);
    }
  }

  void rc(long l, long v, long r, String var) {
    myAssert(l <= v && v <= r, var + " is out of bounds!");
  }

  int MAX_N = 100000;
  int MAX_C = 10000;
  int MAX_T = 1000000000;
  void solve() throws IOException {
    int n = nextInt();
    rc(2, n, MAX_N, "N");
    int R = nextInt();
    rc(0, R, MAX_C, "R");

    double ans = 0;
    long t1 = nextLong();
    rc(0, t1, MAX_T, "t (line 1)");
    long x1 = nextLong();
    rc(-MAX_C, x1, MAX_C, "x1 (line 1)");
    long y1 = nextLong();
    rc(-MAX_C, y1, MAX_C, "y1 (line 1)");
    long x2 = nextLong();
    rc(-MAX_C, x2, MAX_C, "x2 (line 1)");
    long y2 = nextLong();
    rc(-MAX_C, y2, MAX_C, "y2 (line 1)");
    long dx1 = x1 - x2;
    long dy1 = y1 - y2;
    for (int i = 0; i < n - 1; i++) {
      long t2 = nextLong();
      rc(0, t2, MAX_T, "t (line " + (i + 2) + ")");
      myAssert(t1 < t2, "Time machine was used =)");
      x1 = nextLong();
      rc(-MAX_C, x1, MAX_C, "x1 (line " + (i + 2) + ")");
      y1 = nextLong();
      rc(-MAX_C, y1, MAX_C, "y1 (line " + (i + 2) + ")");
      x2 = nextLong();
      rc(-MAX_C, x2, MAX_C, "x2 (line " + (i + 2) + ")");
      y2 = nextLong();
      rc(-MAX_C, y2, MAX_C, "y2 (line " + (i + 2) + ")");
      long dx2 = x1 - x2;
      long dy2 = y1 - y2;

      dx1 -= dx2;
      dy1 -= dy2;

      double a = dx1 * dx1 + dy1 * dy1;
      double b = dx2 * dx1 + dy2 * dy1;
      double c = dx2 * dx2 + dy2 * dy2 - R * R;

      double l = Math.max(-b - Math.sqrt(b * b - a * c), 0);
      double r = Math.min(-b + Math.sqrt(b * b - a * c), a);
      ans += (t2 - t1) * (r - l) / a;
      t1 = t2;
      dx1 = dx2;
      dy1 = dy2;
    }

    out.println(ans);

  }

}
