#include<bits/stdc++.h>
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define sz(x) (ll)(x.size())
using namespace std;


const int mod = 1e9+7;

int expo_pow(int x,int y){
 if(y == 0) return 1;
  y=y%(mod-1);
  x%=mod;
  if(y==0) y=mod-1;
  int res=1;
  while(y){
    if(y&1) res=(res*x)%mod;
    x=(x*x)%mod;
    y>>=1; 
  }
  return res;
}

ll add()
{
    return 0;
}

template <typename T, typename... Types>
T add(T var1, Types... var2){
    return (((((ll)(var1)) % mod + (ll)(add(var2...))) % mod) + mod) % mod;
}

ll mul(){
    return 1;
}

template <typename T, typename... Types>
T mul(T var1, Types... var2){
    return (((ll)(var1)) % mod * (ll)(mul(var2...))) % mod;
}

inline double dist(double x1,double y1,double x2,double y2) {
  double ans = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
  ans = sqrt(ans);
  return ans;
}

void solve(){
  int n,h;
  cin >> n >> h;
  double x[n],y[n];
  for (int i = 0; i < n ;++i) {
    int x_,y_;
    cin >> x_ >> y_;
    x[i] = x_;
    y[i] = y_;
  }
  double x_eye = x[n-1];
  double y_eye = y[n-1] + h;


  int idx = -1;
  double ans = 0;
  int fl = 1;

  for (int i = n-2; i >= 0; --i) {
    if (idx == -1) {
      ans += dist(x[i],y[i],x[i+1],y[i+1]);
      idx = i;
      continue;
    }

    double m = ((y_eye - 1.0*y[idx]))/(x_eye - 1.0*x[idx]);
    double c = y_eye - m*x_eye;
    double x_cur = x[i];
    double y_cur = y[i];
    double x_nx = x[i+1];
    double y_nx = y[i+1];
    double m2 = (1.0*(y_nx - y_cur))/(x_nx - x_cur);
    double c2 = y_cur - m2*x_cur;
    double x_inter = -1;
    double y_inter = -1;
    if (m != m2) {
      x_inter = (c - c2)/(m2 - m);
      y_inter = m2*x_inter + c2; 
    }

    if ( m < 0) {
      if (y[i] <= y[i+1]) {
        continue;
      }
      if (m2 >= 0) continue;
      if (m2 == m) {
        if (c == c2){
          ans += dist(x[i],y[i],x[i+1],y[i+1]);
        }
        continue;
      }
      if (y[i] > x[i]*m + c) {
        idx = i;

        double x_inter = (c - c2)/(m2 - m);
        double y_inter = m2*x_inter + c2;
        ans += dist(x_inter,y_inter,x[i],y[i]);
      }
      continue;
    }
    if (m == 0) {
      if (m2 == 0) {
        if (y[i] == y_eye) {
          idx = i;
          ans += dist(x[i],y[i],x[i+1],y[i+1]);
        }
        else if (y[i] > y_eye) {
          idx = i;
        }
        continue;
      }
      else if (m2 > 0) continue;
      if (y[i] >= c) {
        idx = i;
        double y_inter = c;
        double x_inter = (y_inter - c2)/m2;
        ans += dist(x[i],y[i],x_inter,y_inter);
      }
      continue;
    }
    if (m2 > m) continue;
    if (m2 == m) {
      if (c == c2) {
        idx = i;
        ans += dist(x[i],y[i],x[i+1],y[i+1]);
      }
      continue;
    }

    if (m2 <= 0) {
      double x_inter = (c - c2)/(m2 - m);
      double y_inter = m2*x_inter + c2;
      if (x_inter >= x[i+1]) {
        idx = i;
        ans += dist(x[i],y[i],x[i+1],y[i+1]);
        continue;
      }
      else if (x_inter < x[i]) {
        continue;
      }
      idx = i;
      ans += dist(x[i],y[i],x_inter,y_inter);
      continue;
    }

    if (x_inter < x[i]) continue;
    idx = i;
    ans += dist(x[i],y[i],x_inter,y_inter);


  }
  cout << setprecision(10) << fixed  << ans << "\n";
  

}


signed main(){
  fast;
  int test = 1;
  int i=1;
  while(test--){
    solve();
  }
}
