#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <int , int> pii;
typedef long double ld;

const int N = 2e5+10 , mod = 1e9+7;

ld dis(ld x , ld y , ld z , ld w){
   return sqrt((z - x) * (z - x) + (w - y) * (w - y));
}

void solve(){
   int n , h;
   cin >> n >> h;
   int x[n] , y[n];
   for(int i = 0 ; i < n ; i++){
      cin >> x[i] >> y[i];
   }
   int posx = x[n - 1] , posy = y[n - 1] + h;
   ld cur = -mod;
   int id = n - 1;
   ld ans = 0 , tot = 0;
   cout << fixed << setprecision(6);
   for(int i = n - 2 ; i >= 0 ; i--){
      tot += dis(x[i] , y[i] , x[i + 1] , y[i + 1]);
      ld val = ld(posy - y[i]) / ld(posx - x[i]);
      if(-val < cur){
         continue;
      }

      if(i != n - 2){
         ld a1 = ld(y[i + 1] - y[i]) / ld(x[i + 1] - x[i]);
         ld b1 = -1;
         ld c1 = b1 * y[i + 1] + a1 * x[i + 1];
         ld a2 = -cur;
         ld b2 = -1;
         ld c2 = b2 * posy + a2 * posx;

         //cout << i << " " << a1 << " " << b1 << " " << a2 << " " << b2 << endl;

         ld det = a1 * b2 - a2 * b1;
         if(det != 0){
            ld xx = (c1 * b2 - c2 * b1) / det;
            ld yy = (a1 * c2 - a2 * c1) / det;

            //cout << i << " " << xx << " " << yy << endl;

            ans += dis(xx , yy , x[i] , y[i]);
         }
         else{
            ans += dis(x[i] , y[i] , x[i + 1] , y[i + 1]);
         }
      }
      else{
         ans = tot;
      }

      id = i;
      cur = -val;

      //cout << i << " " << ans << " " << tot << endl;
   }
   cout << fixed << setprecision(6) << ans << "\n";
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int t = 1;
   // cin >> t;
   while(t--){
      solve();
   }
   return 0;
}
