#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define ld long double
#define sz(x) (int)x.size()
#define pdd pair<ld, ld>

const int MOD = 1e9 + 7;
const int MAX_N = 2e5 + 5;

ld dist(ld x1, ld y1, ld x2, ld y2) {
    ld dx = x1 - x2;
    ld dy = y1 - y2;
    ld ans = dx * dx + dy * dy;
    ans = sqrt(ans);
    return ans;
}
pdd lineLineIntersection(ld a1, ld b1, ld c1, ld a2, ld b2, ld c2) {

    ld determinant = a1 * b2 - a2 * b1;

    ld x = (b2 * c1 - b1 * c2) / determinant;
    ld y = (a1 * c2 - a2 * c1) / determinant;
    return make_pair(x, y);
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, H;
    cin >> n >> H;
    int x[n], y[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    int tpx = x[n - 1];
    int tpy = y[n - 1] + H;

    ld sl = 1e150;

    ld ans = 0;

    for (int i = n - 2; i >= 0; i--) {
        int dx1 = x[i] - tpx;
        int dx2 = x[i + 1] - tpx;
        int dy1 = y[i] - tpy;
        int dy2 = y[i + 1] - tpy;
        ld s1 = dy1 * 1.0 / dx1;
        ld s2 = dy2 * 1.0 / dx2;
        if (s1 > sl) {
            // cout << i << "\n";
            // cout << sl << " " << s1 << "\n";
            continue;
        }
        int dx3 = x[i] - x[i + 1];
        int dy3 = y[i] - y[i + 1];
        ld nsl = dy3 * 1.0 / dx3;
        ld c1 = -nsl * x[i] + y[i];
        ld c2 = -sl * tpx + tpy;
        pdd inter = lineLineIntersection(-nsl, 1, c1, -sl, 1, c2);
        ld cans = min(dist(x[i], y[i], x[i + 1], y[i + 1]),
                      dist(x[i], y[i], inter.first, inter.second));
        ans += cans;
        // cout << s1 << " " << s2 << "\n";
        if (i == n - 2) {
            sl = min(sl, s1);
        } else
            sl = min({sl, s1, s2});
    }
    cout << setprecision(15) << ans;

    return 0;
}