Problem: The hobbits Frodo and Sam are carrying the One Ring to Mordor. In order not to be spotted by orcs, they decided to go through the mountains.

The mountain relief can be represented as a polyline with n points (x_i, y_i), numbered from 1 to n (x_i < x_{i + 1} for 1 ≤ i ≤ n - 1). Hobbits start their journey at the point (x_1, y_1) and should reach the point (x_n, y_n) to complete their mission.

The problem is that there is a tower with the Eye of Sauron, which watches them. The tower is located at the point (x_n, y_n) and has the height H, so the Eye is located at the point (x_n, y_n + H). In order to complete the mission successfully, the hobbits have to wear cloaks all the time when the Sauron Eye can see them, i. e. when there is a direct line from the Eye to the hobbits which is not intersected by the relief.

The hobbits are low, so their height can be considered negligibly small, but still positive, so when a direct line from the Sauron Eye to the hobbits only touches the relief, the Eye can see them.

<image> The Sauron Eye can't see hobbits when they are in the left position, but can see them when they are in the right position.

The hobbits do not like to wear cloaks, so they wear them only when they can be spotted by the Eye. Your task is to calculate the total distance the hobbits have to walk while wearing cloaks.

Input

The first line of the input contains two integers n and H (2 ≤ n ≤ 2 ⋅ 10^5; 1 ≤ H ≤ 10^4) — the number of vertices in polyline and the tower height.

The next n lines contain two integers x_i, y_i each (0 ≤ x_i ≤ 4 ⋅ 10^5; 0 ≤ y_i ≤ 10^4) — the coordinates of the polyline vertices. It is guaranteed that x_i < x_{i + 1} for 1 ≤ i ≤ n - 1.

Output

Print one real number — the total distance the hobbits have to walk while wearing cloaks. Your answer will be considered correct if its absolute or relative error does not exceed 10^{-6} — formally, if your answer is a, and the jury's answer is b, your answer will be accepted if (|a - b|)/(max(1, b)) ≤ 10^{-6}.

Examples

Input


6 10
10 40
20 10
25 30
30 15
50 15
65 30


Output


70.4034587602


Input


9 5
0 0
5 10
15 10
20 0
25 11
30 0
35 10
50 10
60 5


Output


27.2787986124


Input


2 10000
0 10000
400000 0


Output


400124.9804748512

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
 
#define ftype long double 
#define ld long double

const ld EPS = 1e-12;

//make sure to define ftype as int / float / double as required
//It can be used as 2D as well

struct point {
    ftype x, y, z=0;
    point() {}
    point(ftype x, ftype y, ftype z=0): x(x), y(y), z(z) {}
    
    point& operator=( pair<ftype,ftype> P)
    {
     x=P.first;
     y=P.second;
        return *this;
    }

    bool operator==(const point &t)
    {
      return (x==t.x && y==t.y && z==t.z);  
    }
    
    point& operator+=(const point &t) {
        x += t.x;
        y += t.y;
        z += t.z;
        return *this;
    }
    
    
    point& operator-=(const point &t) {
        x -= t.x;
        y -= t.y;
        z -= t.z;
        return *this;
    }
    
     point& operator/=(const point &t) {
        
        return *this;
    }
    
    point& operator*=(ftype t) {
        x *= t;
        y *= t;
        z *= t;
        return *this;
    }
    point& operator/=(ftype t) {
        x /= t;
        y /= t;
        z /= t;
        return *this;
    }
    
    point operator+(const point &t) const {
        return point(*this) += t;
    }
    point operator-(const point &t) const {
        return point(*this) -= t;
    }
    point operator*(ftype t) const {
        return point(*this) *= t;
    }
  
    point operator/(ftype t) const {
        return point(*this) /= t;
    }
    
    point operator/(const point &t) const {
        return point(*this) /= t;
    }
    
    
    bool operator<(const point& p) const
    {
        return x < p.x - EPS || (abs(x - p.x) < EPS && y < p.y - EPS);
    }
    
};


int sgn(long long val){
    return val > 0 ? 1 : (val == 0 ? 0 : -1);
}

ftype dot(point a, point b) {
    return a.x * b.x + a.y * b.y + a.z * b.z;
}

ftype norm(point a) {
    return dot(a, a);
}

double abs(point a) {
    return sqrt(norm(a));
}

double proj(point a, point b) {
    return dot(a, b) / abs(b);
}

double angle(point a, point b) {
    return acos(dot(a, b) / abs(a) / abs(b));
}

point cross(point a, point b) {
    return point(a.y * b.z - a.z * b.y,
                   a.z * b.x - a.x * b.z,
                   a.x * b.y - a.y * b.x);
}

//clockwise : right turn
bool cw(point a, point b, point c) { 
    return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y) <= 0;
}

//counter-clockwise : left turn
bool ccw(point a, point b, point c) {
    return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y) > 0;
}

double cross2d(point a,point b)
{
 return cross(a,b).z;   
}

//only for 2D lines given in vector form
point intersect (point a1, point d1, point a2, point d2) {
    return a1 + d1*(cross(a2 - a1, d2).z/cross(d1, d2).z ) ;
}

//ax + by = c
struct line
{
 ftype a,b,c;
    
    line() {}
    
    //passing through p and q
    line(point p,point q)
    {
     a=p.y-q.y;
     b=q.x-p.x;
     c=(a*p.x)+(b*p.y);
        
    norm();
    }
    
    line(ftype a1,ftype b1,ftype c1)
    {
    a = a1;
    b = b1;
    c = c1;
        
        norm();
    }
    
    void norm()
    {
        double z = sqrt(a * a + b * b);
        if (abs(z) > EPS)
            a /= z, b /= z, c /= z;
        
        if(a<0 || (a==0 && b<0) ) 
            a=-a,b=-b,c=-c;
    }
    
    double distance(point p)
    { 
      norm();
      return abs(a*p.x + b*p.y - c); 
    }
    
    void shift_origin(point p)
    {
     c = c - (p.x*a + p.y*b);       
    }
    
};

ftype give_x(line L,ftype y)
{
    if(L.a==0) { cerr << " error : parallel to  x axis\n"; return -1; }
 return (L.c-(L.b*y))/(L.a);   
}

ftype give_y(line L,ftype x)
{
        if(L.b==0) { cerr << " error : parallel to  y axis\n"; return -1; }
 return (L.c-(L.a*x))/(L.b);   
}

bool satisfy(line L,point p)
{
return (L.a*p.x + L.b*p.y == L.c);
}

double det(double a, double b, double c, double d) {
    return a*d - b*c;
}

//for line in 2-D
bool intersect(line m, line n, point & res) {
    double zn = det(m.a, m.b, n.a, n.b);
    if (abs(zn) < EPS)
        return false;
    res.x = -det(m.c, m.b, n.c, n.b) / zn;
    res.y = -det(m.a, m.c, n.a, n.c) / zn;
    return true;
}

bool parallel(line m, line n) {
    return abs(det(m.a, m.b, n.a, n.b)) < EPS;
}

bool equivalent(line m, line n) {
    return abs(det(m.a, m.b, n.a, n.b)) < EPS
        && abs(det(m.a, m.c, n.a, n.c)) < EPS
        && abs(det(m.b, m.c, n.b, n.c)) < EPS;
}

double distance(line a,line b)
{
   a.norm();
   b.norm();
    
    if(parallel(a,b) ) return 0;
    else return abs(a.c-b.c);
}

//intersection of 2D line-segments , given endpoints of both segments
//All cases covered
inline bool betw(double l, double r, double x)
{
    return min(l, r) <= x + EPS && x <= max(l, r) + EPS;
}

inline bool seg_intersect_1d(double a, double b, double c, double d)
{
    if (a > b)
        swap(a, b);
    if (c > d)
        swap(c, d);
    return max(a, c) <= min(b, d) + EPS;
}

bool seg_intersect(point a, point b, point c, point d, point& left, point& right)
{
    if (!seg_intersect_1d(a.x, b.x, c.x, d.x) || !seg_intersect_1d(a.y, b.y, c.y, d.y))
        return false;
    
    line m(a, b);
    line n(c, d);
    
    double zn = det(m.a, m.b, n.a, n.b);
    
    if (abs(zn) < EPS) {
        if (abs(m.distance(c)) > EPS || abs(n.distance(a)) > EPS)
            return false;
        
        if (b < a)
            swap(a, b);
        if (d < c)
            swap(c, d);
        left = max(a, c);
        right = min(b, d);
        return true;
    } else {
    
        left.x = right.x = det(m.c, m.b, n.c, n.b) / zn;
        left.y = right.y = det(m.a, m.c, n.a, n.c) / zn;
        
        return betw(a.x, b.x, left.x) && betw(a.y, b.y, left.y) &&
               betw(c.x, d.x, left.x) && betw(c.y, d.y, left.y);
    }
}

#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define precise(x) fixed << setprecision(x) 

ld dis(pair<ld,ld> x,pair<ld,ld> y)
{
    return sqrt((x.F - y.F)*(x.F - y.F) + (x.S - y.S)*(x.S - y.S));
}

void solve()
{
   int n,h;
   scanf("%d %d",&n,&h);
    
   point a[n];
   int y1,y2; 
    
   f(i,n)
   {         
      scanf("%d %d",&y1,&y2);
       
      a[i].x = y1;
      a[i].y = y2;
   }
    
    
   point sun = a[n-1];
   sun.y += h ;
    
   ld tot = 0.00000000;
   point saver = a[n-1]; 
    
   for(int i=n-2;i>=0;i--)
   {
       ld l = a[i].x;
       ld r = a[i+1].x;
       ld slope = (a[i+1].y - a[i].y) / (a[i+1].x - a[i].x);
       
       point res = a[i];
       point t1,t2;
      
       f(j,60)
       {
           res.x = (l + r)/2;
           res.y = (slope*(res.x - a[i].x)) + a[i].y;
           
           int flag = 0; 
           
           if(ccw(sun,saver,res)) flag = 1;
           
           if(flag) r = res.x;
           else l = res.x;
       }
       
       tot += abs(a[i] - res);
   
       if(cw(sun,saver, a[i])) saver = a[i];
   }
   
   cout << precise(9) << tot;
}

signed main()
{
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}