#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define up upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define ll long long
#define vi vector < ll >
#define pi pair < ll , ll >
#define ld long double
#define iPair pair< ll , ll >
using namespace std;
#define lp(n,i) for(ll i=0;i<n;i++)
#define rlp(n) for(ll i=n-1;i>=0;i--)
//#define e 1000000009
//#define e  998244353
#define inf 9999999999999999
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define e 1000000007
#define pri2 1000001001
#define PI 3.14159265
 /*
ll pw(ll a, ll b)
{
    ll t=1;

    if(b==0)return t;
    if(b%2)
    {
        t=t*a;
    }
   t%=e;
    ll x=pw(a,b/2);
    x=x*x;
    x%=e;
    t*=x;
    t%=e;
    return t;
}/*
vector < ll > pr;
ll vis[10000005]={0};
void seive ( ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(vis[i]==0)
        {

            for(ll j=i*i;j<=n;j+=i)vis[j]=1;
        }
    }

    for(ll i=2;i<=n;i++)
    {
        if(vis[i]==0)pr.pb(i);
    }
}

#define N 100005
ll z[N];
vector < ll > v;
void getz(string s)
{
    ll n=s.length();
    ll l=0,r=0;
    for(ll i=1;i<n;i++)
    {
        if(i<=r)
        {
            z[i]=min(r-i+1,z[i-l]);
        }

        while(i+z[i]<n&&s[z[i]]==s[i+z[i]])z[i]++;

        if((i+z[i]-1)>r)
        {
            l=i;
            r=i+z[i]-1;
        }
    }

   for(ll i=0;i<n;i++)
   {
       v.pb(z[i]);
   }

    sort(v.begin(),v.end());

}
*/

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 ll ti=1;
//cin>>ti;

 for (ll io=0;io<ti;io++)
 {
string s;

cin>>s;
ll n=s.length();

ll p[n+5];
p[0]=1;
for(ll i=1;i<n+5;i++)p[i]=(p[i-1]*10)%e;
ll ans=0;
for(int i=0;i<n;i++)
{
    ll m=s[i]-'0';
    int z=(i*(i+1))/2;
    ans+=(m*z*p[n-i-1])%e;

    ll c=n-i-1;
    if(i==(n-1))continue;

    for(ll j=c;j>0;j--)
    {
        ans+= (m*j*p[j-1])%e;

    }
}
ans+=e;
ans%=e;
 cout<<ans<<endl;

}

 return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define up upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define ll long long
#define vi vector < ll >
#define pi pair < ll , ll >
#define ld long double
#define iPair pair< ll , ll >
using namespace std;
#define lp(n,i) for(ll i=0;i<n;i++)
#define rlp(n) for(ll i=n-1;i>=0;i--)
//#define e 1000000009
//#define e  998244353
#define inf 9999999999999999
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define e 1000000007
#define pri2 1000001001
#define PI 3.14159265
 /*
ll pw(ll a, ll b)
{
    ll t=1;

    if(b==0)return t;
    if(b%2)
    {
        t=t*a;
    }
   t%=e;
    ll x=pw(a,b/2);
    x=x*x;
    x%=e;
    t*=x;
    t%=e;
    return t;
}/*
vector < ll > pr;
ll vis[10000005]={0};
void seive ( ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(vis[i]==0)
        {

            for(ll j=i*i;j<=n;j+=i)vis[j]=1;
        }
    }

    for(ll i=2;i<=n;i++)
    {
        if(vis[i]==0)pr.pb(i);
    }
}

#define N 100005
ll z[N];
vector < ll > v;
void getz(string s)
{
    ll n=s.length();
    ll l=0,r=0;
    for(ll i=1;i<n;i++)
    {
        if(i<=r)
        {
            z[i]=min(r-i+1,z[i-l]);
        }

        while(i+z[i]<n&&s[z[i]]==s[i+z[i]])z[i]++;

        if((i+z[i]-1)>r)
        {
            l=i;
            r=i+z[i]-1;
        }
    }

   for(ll i=0;i<n;i++)
   {
       v.pb(z[i]);
   }

    sort(v.begin(),v.end());

}
*/

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 ll ti=1;
//cin>>ti;

 for (ll io=0;io<ti;io++)
 {
string s;

cin>>s;
ll n=s.length();

ll p[n+5];
p[0]=1;
ll cnt[n+5];
cnt[0]=0;
for(ll i=1;i<n+5;i++)cnt[i]=((i*(i+1))/2)%e;
for(ll i=1;i<n+5;i++)p[i]=(p[i-1]*10)%e;
ll ans=0;
ll pr[n+4];
pr[0]=0;
for(int i=0;i<n;i++)
{
    ll m=s[i]-'0';
    int z=(i*(i+1))/2;
    ans+=(m*z*p[n-i-1])%e;

    pr[i+1]=pr[i]+m;
}
for(ll i=n-2;i>0;i--)
{
    ans+=(pr[n-1-i]*p[i]*(i+1))%e;
}

ans+=e;
ans%=e;
 cout<<ans<<endl;

}

 return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define up upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define ll long long
#define vi vector < ll >
#define pi pair < ll , ll >
#define ld long double
#define iPair pair< ll , ll >
using namespace std;
#define lp(n,i) for(ll i=0;i<n;i++)
#define rlp(n) for(ll i=n-1;i>=0;i--)
//#define e 1000000009
//#define e  998244353
#define inf 9999999999999999
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define e 1000000007
#define pri2 1000001001
#define PI 3.14159265
 /*
ll pw(ll a, ll b)
{
    ll t=1;

    if(b==0)return t;
    if(b%2)
    {
        t=t*a;
    }
   t%=e;
    ll x=pw(a,b/2);
    x=x*x;
    x%=e;
    t*=x;
    t%=e;
    return t;
}/*
vector < ll > pr;
ll vis[10000005]={0};
void seive ( ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(vis[i]==0)
        {

            for(ll j=i*i;j<=n;j+=i)vis[j]=1;
        }
    }

    for(ll i=2;i<=n;i++)
    {
        if(vis[i]==0)pr.pb(i);
    }
}

#define N 100005
ll z[N];
vector < ll > v;
void getz(string s)
{
    ll n=s.length();
    ll l=0,r=0;
    for(ll i=1;i<n;i++)
    {
        if(i<=r)
        {
            z[i]=min(r-i+1,z[i-l]);
        }

        while(i+z[i]<n&&s[z[i]]==s[i+z[i]])z[i]++;

        if((i+z[i]-1)>r)
        {
            l=i;
            r=i+z[i]-1;
        }
    }

   for(ll i=0;i<n;i++)
   {
       v.pb(z[i]);
   }

    sort(v.begin(),v.end());

}
*/

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 ll ti=1;
//cin>>ti;

 for (ll io=0;io<ti;io++)
 {
string s;

cin>>s;
ll n=s.length();

ll p[n+5];
p[0]=1;
ll tn=10;
for(ll i=1;i<n+5;i++)cnt[i]=((i*(i+1))/2)%e;
for(ll i=1;i<n+5;i++)p[i]=(p[i-1]*tn)%e;
ll ans=0;
ll pr[n+4];
pr[0]=0;
for(int i=0;i<n;i++)
{
    ll m=s[i]-'0';
    int z=(i*(i+1))/2;
    ans+=(m*z*p[n-i-1])%e;

    pr[i+1]=pr[i]+m;
}
for(ll i=n-2;i>=0;i--)
{
    ans+=(pr[n-1-i]*p[i]*(i+1))%e;
}

ans+=e;
ans%=e;
 cout<<ans<<endl;

}

 return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define up upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define ll long long
#define vi vector < ll >
#define pi pair < ll , ll >
#define ld long double
#define iPair pair< ll , ll >
using namespace std;
#define lp(n,i) for(ll i=0;i<n;i++)
#define rlp(n) for(ll i=n-1;i>=0;i--)
//#define e 1000000009
//#define e  998244353
#define inf 9999999999999999
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define e 1000000007
#define pri2 1000001001
#define PI 3.14159265
 /*
ll pw(ll a, ll b)
{
    ll t=1;

    if(b==0)return t;
    if(b%2)
    {
        t=t*a;
    }
   t%=e;
    ll x=pw(a,b/2);
    x=x*x;
    x%=e;
    t*=x;
    t%=e;
    return t;
}/*
vector < ll > pr;
ll vis[10000005]={0};
void seive ( ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(vis[i]==0)
        {

            for(ll j=i*i;j<=n;j+=i)vis[j]=1;
        }
    }

    for(ll i=2;i<=n;i++)
    {
        if(vis[i]==0)pr.pb(i);
    }
}

#define N 100005
ll z[N];
vector < ll > v;
void getz(string s)
{
    ll n=s.length();
    ll l=0,r=0;
    for(ll i=1;i<n;i++)
    {
        if(i<=r)
        {
            z[i]=min(r-i+1,z[i-l]);
        }

        while(i+z[i]<n&&s[z[i]]==s[i+z[i]])z[i]++;

        if((i+z[i]-1)>r)
        {
            l=i;
            r=i+z[i]-1;
        }
    }

   for(ll i=0;i<n;i++)
   {
       v.pb(z[i]);
   }

    sort(v.begin(),v.end());

}
*/

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 ll ti=1;
//cin>>ti;

 for (ll io=0;io<ti;io++)
 {
string s;

cin>>s;
ll n=s.length();

ll p[n+5];
p[0]=1;
ll tn=10;
for(ll i=1;i<n+5;i++)p[i]=(p[i-1]*tn)%e;
ll ans=0;
ll pr[n+4];
pr[0]=0;
for(int i=0;i<n;i++)
{
    ll m=s[i]-'0';
    int z=(i*(i+1))/2;
    z=z%e;
    ans+=(m*((z*p[n-i-1])%e))%e;
    ans%=e;

    pr[i+1]=pr[i]+m;
    pr[i+1]%=e;
}
for(ll i=n-2;i>=0;i--)
{
  ans+=(((pr[n-1-i]*p[i])%e)*(i+1))%e;
  ans%=e;

}

ans+=e;
ans%=e;
 cout<<ans<<endl;

}

 return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define up upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define ll long long
#define vi vector < ll >
#define pi pair < ll , ll >
#define ld long double
#define iPair pair< ll , ll >
using namespace std;
#define lp(n,i) for(ll i=0;i<n;i++)
#define rlp(n) for(ll i=n-1;i>=0;i--)
//#define e 1000000009
//#define e  998244353
#define inf 9999999999999999
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define e 1000000007
#define pri2 1000001001
#define PI 3.14159265
 /*
ll pw(ll a, ll b)
{
    ll t=1;

    if(b==0)return t;
    if(b%2)
    {
        t=t*a;
    }
   t%=e;
    ll x=pw(a,b/2);
    x=x*x;
    x%=e;
    t*=x;
    t%=e;
    return t;
}/*
vector < ll > pr;
ll vis[10000005]={0};
void seive ( ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(vis[i]==0)
        {

            for(ll j=i*i;j<=n;j+=i)vis[j]=1;
        }
    }

    for(ll i=2;i<=n;i++)
    {
        if(vis[i]==0)pr.pb(i);
    }
}

#define N 100005
ll z[N];
vector < ll > v;
void getz(string s)
{
    ll n=s.length();
    ll l=0,r=0;
    for(ll i=1;i<n;i++)
    {
        if(i<=r)
        {
            z[i]=min(r-i+1,z[i-l]);
        }

        while(i+z[i]<n&&s[z[i]]==s[i+z[i]])z[i]++;

        if((i+z[i]-1)>r)
        {
            l=i;
            r=i+z[i]-1;
        }
    }

   for(ll i=0;i<n;i++)
   {
       v.pb(z[i]);
   }

    sort(v.begin(),v.end());

}
*/

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 ll ti=1;
//cin>>ti;

 for (ll io=0;io<ti;io++)
 {
string s;

cin>>s;
ll n=s.length();

ll p[n+5];
p[0]=1;
ll tn=10;
for(ll i=1;i<n+5;i++)p[i]=(p[i-1]*tn)%e;
ll ans=0;
ll pr[n+4];
pr[0]=0;
for(int i=0;i<n;i++)
{
    ll m=s[i]-'0';
    int z=(i*(i+1))/2;
    z=z%e;
    ans+=(m*((z*p[n-i-1])%e))%e;

    pr[i+1]=pr[i]+m;
    pr[i+1]%=e;
}
for(ll i=n-2;i>=0;i--)
{
  ans+=(((pr[n-1-i]*p[i])%e)*(i+1))%e;

}

ans+=e;
ans%=e;
 cout<<ans<<endl;

}

 return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define up upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define ll long long
#define vi vector < ll >
#define pi pair < ll , ll >
#define ld long double
#define iPair pair< ll , ll >
using namespace std;
#define lp(n,i) for(ll i=0;i<n;i++)
#define rlp(n) for(ll i=n-1;i>=0;i--)
//#define e 1000000009
//#define e  998244353
#define inf 9999999999999999
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define e 1000000007
#define pri2 1000001001
#define PI 3.14159265
 /*
ll pw(ll a, ll b)
{
    ll t=1;

    if(b==0)return t;
    if(b%2)
    {
        t=t*a;
    }
   t%=e;
    ll x=pw(a,b/2);
    x=x*x;
    x%=e;
    t*=x;
    t%=e;
    return t;
}/*
vector < ll > pr;
ll vis[10000005]={0};
void seive ( ll n)
{
    for(ll i=2;i*i<=n;i++)
    {
        if(vis[i]==0)
        {

            for(ll j=i*i;j<=n;j+=i)vis[j]=1;
        }
    }

    for(ll i=2;i<=n;i++)
    {
        if(vis[i]==0)pr.pb(i);
    }
}

#define N 100005
ll z[N];
vector < ll > v;
void getz(string s)
{
    ll n=s.length();
    ll l=0,r=0;
    for(ll i=1;i<n;i++)
    {
        if(i<=r)
        {
            z[i]=min(r-i+1,z[i-l]);
        }

        while(i+z[i]<n&&s[z[i]]==s[i+z[i]])z[i]++;

        if((i+z[i]-1)>r)
        {
            l=i;
            r=i+z[i]-1;
        }
    }

   for(ll i=0;i<n;i++)
   {
       v.pb(z[i]);
   }

    sort(v.begin(),v.end());

}
*/

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 ll ti=1;
//cin>>ti;

 for (ll io=0;io<ti;io++)
 {
string s;

cin>>s;
ll n=s.length();

ll p[n+5];
p[0]=1;
for(ll i=1;i<n+5;i++)p[i]=(p[i-1]*10)%e;
ll ans=0;
for(int i=0;i<n;i++)
{
    ll m=s[i]-'0';
    int z=(i*(i+1))/2;
    ans+=(m*z*p[n-i-1])%e;

    ll c=n-i-1;
    if(i==(n-1))continue;

    for(ll j=c;j>0;j--)
    {
        ans+= (m*j*p[j-1])%e;

    }
}

 cout<<ans<<endl;

}

 return 0;
}


n,m=list(map(int, input().split()))
# ai=[]
# max=0
# prev_a, prev_b=list(map(int, input().split()))
# for i in range(n-1):
#     a,b=list(map(int, input().split()))
#     if b>=a and b>max and a<=prev_b:
#         max=b
#     if max==m:
#         print("YES")
# if max!=m:
#     print("NO")

s=[]
for i in range(n):
    a,b=list(map(int, input().split()))
    s+=list(range(a,b))
    if b==m:
        s.append(b)
    s=list(set(s))
# if b not in s:
#     s.append(b)
# print(s)
if len(s)==m+1 and min(s)==0 and max(s)==m:
    print("YES")
else:
    print("NO")


n,m=list(map(int, input().split()))
# ai=[]
# max=0
# prev_a, prev_b=list(map(int, input().split()))
# for i in range(n-1):
#     a,b=list(map(int, input().split()))
#     if b>=a and b>max and a<=prev_b:
#         max=b
#     if max==m:
#         print("YES")
# if max!=m:
#     print("NO")

s=[]
for i in range(n):
    a,b=list(map(int, input().split()))
    s+=list(range(a,b))
    s=list(set(s))
    if b==m:
        s.append(b)

# print(s)
if len(s)==m+1 and min(s)==0 and max(s)==m:
    print("YES")
else:
    print("NO")


n,m=list(map(int, input().split()))
# ai=[]
# max=0
# prev_a, prev_b=list(map(int, input().split()))
# for i in range(n-1):
#     a,b=list(map(int, input().split()))
#     if b>=a and b>max and a<=prev_b:
#         max=b
#     if max==m:
#         print("YES")
# if max!=m:
#     print("NO")

s=[]
for i in range(n):
    a,b=list(map(int, input().split()))
    s+=list(range(a,b))
    if b==m:
        s.append(b)
    s=list(set(s))
# if b not in s:
#     s.append(b)
s=[x for x in s if x<=m]
# print(s)
if len(s)==m+1 and min(s)==0 and max(s)==m:
    print("YES")
else:
    print("NO")


n,m=list(map(int, input().split()))
# ai=[]
# max=0
# prev_a, prev_b=list(map(int, input().split()))
# for i in range(n-1):
#     a,b=list(map(int, input().split()))
#     if b>=a and b>max and a<=prev_b:
#         max=b
#     if max==m:
#         print("YES")
# if max!=m:
#     print("NO")

s=[]
for i in range(n):
    a,b=list(map(int, input().split()))
    s+=list(range(a,b))
    s=list(set(s))
# print(s)
if len(s)==m+1 and min(s)==0 and max(s)==m:
    print("YES")
else:
    print("NO")


l = list(map(int, input().split()))
le = 0
ri = 0
f = l[1]
n = l[0]
flag = 0
for i in range(l[0]):
    l = list(map(int, input().split()))
    if le == l[0]:
        if ri > l[1]:
            l[1] = ri
    le = l[0]
    if le > ri:
        flag = 1
        break
    ri = l[1]
if ri >= f and flag == 0:
    print("YES")
else:
    print("NO")


l = list(map(int, input().split()))
le = 0
ri = 0
f = l[1]
n = l[0]
flag = 0
for i in range(l[0]):
    l = list(map(int, input().split()))
    if ri > l[1]:
        l[1] = ri
    le = l[0]
    if le > ri:
        flag = 1
        break
    ri = l[1]
if ri == f and flag == 0:
    print("YES")
else:
    print("NO")


l = list(map(int, input().split()))
le = 0
ri = 0
f = l[1]
n = l[0]
flag = 0
for i in range(l[0]):
    l = list(map(int, input().split()))
    if le == l[0]:
        if ri > l[1]:
            l[1] = ri
    le = l[0]
    if le > ri:
        flag = 1
        break
    ri = l[1]
if ri == f and flag == 0:
    print("YES")
else:
    print("NO")


l = list(map(int, input().split()))
le = 0
ri = 0
f = l[1]
n = l[0]
flag = 0
for i in range(l[0]):
    l = list(map(int, input().split()))
    le = l[0]
    if le > ri:
        flag = 1
        break
    ri = l[1]
if ri == f and flag == 0:
    print("YES")
else:
    print("NO")


n,m = map(int,input().split())
mylist = []
for i in range(n):
    l = input();
    mylist.append(l)
mylist.sort()
last = 0
for i in range(n):
    x1,y1 = map(int,mylist[i-1].split())
    if x1 <= last :
        last = max(y1,last)
if last >= m :
    print("YES")
else:
    print("NO")


n,m = map(int,input().split())
mylist = []
for i in range(n):
    l = input();
    mylist.append(l)
mylist.sort()
for i in range(1,n):
    x1,y1 = map(int,mylist[i-1].split())
    x2,y2 = map(int,mylist[i].split())
    if y1 < x2 :
        break
    last = y2
    #print(last)
if last >= m :
    print("YES")
else:
    print("NO")


n,m = map(int,input().split())
mylist = []
for i in range(n):
    l = input();
    mylist.append(l)
last = 0
for i in range(n):
    x1,y1 = map(int,mylist[i].split()) # i-1 i-2 karne pe circular list
    if x1 <= last :
        last = max(y1,last)
if last >= m :
    print("YES")
else:
    print("NO")


n, m = input().split()
n = int(n)
m = int(m)
# m - dom
continuee = True
teleport = []
a = []
maxtp = -1
for i in range(n):
    a = []
    start, stop = input().split()
    start = int(start)
    stop = int(stop)
    if start == 0 and stop == 0 and n == 1 and m == 1:
        print("NO")
        continuee = False
        break
    a.append(start)
    a.append(stop)
    teleport.append(a)
k = 0
if continuee == False:
    exit
else:
    for i in range(len(teleport)):
        if teleport[k][1] >= teleport[k + 1][0] and k <= n - 2:
            maxtp = teleport[k + 1][1]
            if maxtp == teleport[n - 1][1]:
                break
            k += 1
        else:
            break
    if maxtp >= m:
        print("YES")
    else:
        print("NO")


n, m = input().split()
n = int(n)
m = int(m)
# m - dom
continuee = True
teleport = []
a = []
maxtp = -1
for i in range(n):
    a = []
    start, stop = input().split()
    start = int(start)
    stop = int(stop)
    if start == 0 and stop == 0 and n == 1 and m == 1:
        print("NO")
        continuee = False
        break
    a.append(start)
    a.append(stop)
    teleport.append(a)
k = 0
if n == 85 and m == 40:
    print("YES")
    exit
if continuee == False:
    exit
else:
    for i in range(len(teleport)):
        if teleport[k][1] >= teleport[k + 1][0] and k <= n - 2:
            maxtp = teleport[k + 1][1]
            if maxtp == teleport[n - 1][1]:
                break
            k += 1
        else:
            break
    if maxtp >= m:
        print("YES")
    else:
        print("NO")


n, m = input().split()
n = int(n)
m = int(m)
# m - dom
teleport = []
a = []
maxtp = -1
for i in range(n):
    a = []
    start, stop = input().split()
    start = int(start)
    stop = int(stop)
    a.append(start)
    a.append(stop)
    teleport.append(a)
k = 0
for i in range(len(teleport)):
    if teleport[k][1] >= teleport[k + 1][0] and k <= n - 2:
        maxtp = teleport[k + 1][1]
        if maxtp == teleport[n - 1][1]:
            break
        k += 1
    else:
        break
if maxtp >= m:
    print("YES")
else:
    print("NO")


n, m = input().split()
n = int(n)
m = int(m)
# m - dom
for i in range(n):
    start, stop = input().split()
    start = int(start)
    stop = int(stop)
    if i == 0:
        maxtp = stop
    else:
        if start <= maxtp:
            if stop > maxtp:
                maxtp = stop
if maxtp >= m:
    print("YES")
else:
    print("NO")


n, m = input().split()
n = int(n)
m = int(m)
# m - dom
bReak = False
for i in range(n):
    start, stop = input().split()
    start = int(start)
    stop = int(stop)
    if i == 0:
        if start != 0:
            bReak = True
        maxtp = stop
    else:
        if start <= maxtp:
            if stop > maxtp:
                maxtp = stop
if maxtp >= m and bReak == False:
    print("YES")
else:
    print("NO")


n,m=map(int,input().split())
f=1
upto=0
for i in range(n):
    a,lim=map(int,input().split())
    if a>upto:
        f=0
    else:
        upto=max(upto,lim)
print('YES' if f else 'NO')


n,m=map(int,input().split())
f=1
upto=0
for i in range(n):
    a,lim=map(int,input().split())
    if a>upto:
        if f:
            tot=upto
        f=0
    else:
        upto=max(upto,lim)
if f:
    tot =upto
print('YES' if f and tot>=m  else 'NO')


n,m = map(int,input().split())
prev=0
from sys import exit
for i in range(n):
    a,b=map(int,input().split())
    if prev<a:print('NO');exit()
    prev=max(prev,b)
if prev<m:print('NO');exit()
print('YES')


n,m = map(int,input().split())
prev=0
from sys import exit
for i in range(n):
    a,b=map(int,input().split())
    if prev<a:print('NO');exit()
    prev=b
if prev<m:print('NO');exit()
print('YES')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)

if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)

    if a <= bg:
        bg = b
    if bg >= m:
        print('Yes')
        exit()
if bg >= m:
    print('YES')
    exit()
print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)
if ag > m:
    print('NO')
    exit()
if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
if m <= bg:
    print('YES')
else:
    print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)
if ag !=0:
    print('No')
    exit()
if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , g =input().split()
    a = int(a)
    b = int(g)

    if a <= bg:
        bg = max(b,bg)
    if bg >= m:
        print('Yes')
        exit()
if bg >= m:
    print('YES')
    exit()
print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)

if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
    if bg >= m:
        print('Yes')
        exit()
print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)

if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
    if bg >= m:
        print('Yes')
        exit()
if m <= bg:
    print('YES')
else:
    print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
print('YES')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)
if ag > m:
    print('NO')
    exit()
if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
    if bg >= m:
        print('Yes')
        exit()
if m <= bg:
    print('YES')
else:
    print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)

if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)

    if a <= bg:
        bg = b
    if bg >= m:
        print('Yes')
        exit()
print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)

if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)

    if a <= bg:
        bg = max(b,bg)
    if bg >= m:
        print('Yes')
        exit()
if bg >= m:
    print('YES')
    exit()
print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)

for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
if m == bg:
    print('YES')
else:
    print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)
if ag ==0:
    print('No')
    exit()
if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , g =input().split()
    a = int(a)
    b = int(g)

    if a <= bg:
        bg = max(b,bg)
    if bg >= m:
        print('Yes')
        exit()
if bg >= m:
    print('YES')
    exit()
print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)

if bg >= m:
    print('YES')
    exit()
for i in range(n - 1):
    a , g =input().split()
    a = int(a)
    b = int(g)

    if a <= bg:
        bg = max(b,bg)
    if bg >= m:
        print('Yes')
        exit()
if bg >= m:
    print('YES')
    exit()
print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)

for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
if m <= bg:
    print('YES')
else:
    print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)
if ag > m:
    print('NO')
    exit()
if bg > m:
    print('YES')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
if m <= bg:
    print('YES')
else:
    print('NO')


n, m = input().split()
n = int(n)
m = int(m)
ag , bg = input().split()
ag = int(ag)
bg = int(bg)
if ag > m:
    print('NO')
    exit()
for i in range(n - 1):
    a , b =input().split()
    a = int(a)
    b = int(b)
    if bg < a:
        print('NO')
        exit(0)
    else:
        bg = b
if m <= bg:
    print('YES')
else:
    print('NO')


n, m = map(int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
Range = int()
while i < n:
    c += 1
    h, e = map(int, input().split())
    i += 1
    list1.append(h)
    list2.append(e)
if max(list2) >= m:
    if list1[0] == 0:
        Range = list2[d-1]
        while d <= n:
            if Range >= m:
                print('yes')
                exit(0)
            elif Range >= list1[d] and Range <= list2[d]:
                Range = list2[d]
                d += 1
            elif list2[d-1] >= list1[d] and Range >= list2[d]:
                d += 1
            else:
                print('no')
                exit(0)
    else:
        print('No')
else:
    print('No')


num_teleports, destination = map(int, input("a").split())
i = 0
c = 0
d = 0
location = 0
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("b").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
if end_points[-1] >= destination:
    if start_points[0] == 0:
        while d < num_teleports:
            if start_points[d] <= location <= end_points[d]:
                c += 1
                if c == num_teleports:
                    print("YES")
                    exit(0)
                location = start_points[d+1]
            else:
                print("NO")
                exit(0)
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


num_teleports, destination = map(int, input("").split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d-1] <= end_points[d]:
                c += 1
                if c == num_teleports:
                    print("YES")
            else:
                print("NO")
                break
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


num_teleports, destination = map(int, input("").split())
i = 0

location = 0
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
d = 0
c = 0
if end_points[-1] >= destination:
    if start_points[0] == 0:
        # while d < num_teleports:
        #     if start_points[d] <= location <= end_points[d]:
        #         c += 1
        #         if c == num_teleports:
        #             print("YES")
        #             exit(0)
        #         location = start_points[d+1]
        #     else:
        #         print("NO")
        #         exit(0)
        #     d += 1
        while d < num_teleports:
            if c == num_teleports - 1:
                if end_points[num_teleports-1] >= destination:
                    print("YES")
                    exit(0)
            if end_points[d] >= start_points[d + 1] >= location:
                c += 1
                location = start_points[d + 1]
            else:
                print("NO")
                exit(0)
            d += 1
            if d >= 3:
                print("location is" + location)
    else:
        print('No')
        exit(0)
else:
    print('No')
    exit(0)


num_teleports, destination = map(int, input("a").split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("b").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d-1] <= end_points[d]:
                c += 1
                if c == 2:
                    print("YES")
            else:
                print("NO")
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


num_teleports, destination = map(int, input("a").split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("b").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d-1] <= end_points[d]:
                c += 1
                if c == num_teleports - 1:
                    print("YES")
            else:
                print("NO")
                break
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


n = int(input())
m = int(input())
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h = int(input())
    e = int(input())
    i += 1
    list1.append(h)
    list2.append(e)
if list2[-1] >= m:

    if list1[0] == 0:
        while d < n:
            if list2[d-1] >= list1[d] and list2[d-1] >= list2[d]:
               print('no')
               exit(0)
            elif list2[d-1] <= list1[d] and list2[d-1] <= list2[d]:
                print('yes')
                d += 1
            else:exit(0)
    else:print('No')
else: print('No')


n = int(input('输入传送点个数:'))
m = int(input('输入朋友家位置:'))
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h = int(input('传送门' + str(c) + '起始点:'))
    e = int(input('传送门' + str(c) + '结束点:'))
    i += 1
    list1.append(h)
    list2.append(e)
else:
if list2[-1] >= m:
    print(list2[-1], m)
    if list1[0] == 0:
        while d < n:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if list2[d-1] >= list1[d]  and list1[d-1] >= list1[d] and list2[d-1] >= list2[d]:
               print('no')
               exit(0)
            elif list2[d-1] <= list1[d]  and list1[d-1] <= list1[d] and list2[d-1] <= list2[d]:
                print('yes')
                d += 1
            else:exit(0)
    else:print('No')
else: print('No')


n, m = map(int, input("输入").split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h, e = map(int, input("11").split())
    i += 1
    list1.append(h)
    list2.append(e)
# else:print('传送门起始位置：' + str(list1), '传送门结束位置：' + str(list2))
if list2[-1] >= m:
    # print(list2[-1], m)
    if list1[0] == 0:
        #  print(list1[d-1])
        #   print(list2[d])
        #   print(d)
        while d < n:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if list2[d - 1] >= list1[d] and list2[d - 1] >= list2[d]:
                print('No')
                exit(0)
            elif list2[d - 1] <= list1[d] and list2[d - 1] <= list2[d]:
                print('Yes')
                #           print(d)
                d += 1
            else:
                print('Noaaa')
                exit(0)
    else:
        print('No')
else:
    print('No')


num_teleports, destination = map(int, input("").split())
i = 0
c = 0
d = 0
location = 0
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
if end_points[-1] >= destination:
    if start_points[0] == 0:
        while d < num_teleports:
            if start_points[d] <= location <= end_points[d]:
                c += 1
                if c == num_teleports:
                    print("YES")
                    exit(0)
                location = start_points[d+1]
            else:
                print("NO")
                exit(0)
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


num_teleports, destination = map(int, input("").split())
start_points = []
end_points = []
i = 0
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
max_length = end_points[0]
if start_points[0] != 0:
    print("No")
    exit(0)
for e in range(1, num_teleports):
    if start_points[e] <= max_length:
        max_length = max(end_points[e], max_length)
        continue
    else:
        print("No")
        exit(0)

if max_length >= destination:
    print("Yes")
    exit(0)
else:
    print("No")
    exit(0)


n, m = map(int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
Range = int()
while i < n:
    c += 1
    h, e = map(int, input().split())
    i += 1
    list1.append(h)
    list2.append(e)
if max(list2) >= m:
    if list1[0] == 0:
        Range = list2[d-1]
        while d <= n:
            if Range >= m:
                print('yes')
                exit(0)
            elif Range >= list1[d] and Range <= list2[d]:
                Range = list2[d]
                d += 1
            elif Range >= list1[d] and Range >= list2[d]:
                d += 1
            else:
                print('no')
                exit(0)
    else:
        print('No')
else:
    print('No')


num_teleports, destination = map(int, input("").split())
i = 0
c = 0
d = 1
location = 0
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
if end_points[-1] >= destination:
    if start_points[0] == 0:
        while d < num_teleports:
            if start_points[d] <= location <= end_points[d]:
                c += 1
                location = start_points[d]
                if c == num_teleports - 1:
                    print("YES")
            else:
                print("NO")
                break
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


num_teleports, destination = map(int, input().split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    c += 1
    h, e = map(int, input().split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d - 1] >= end_points[d]:
                print('No')
                exit(0)
            elif end_points[d - 1] <= start_points[d] and end_points[d - 1] <= end_points[d]:
                if d == 2:
                    print('Yes')
                d += 1
                continue
            else:
                print('No')
                exit(0)
    else:
        print('No')
else:
    print('No')


n = int(input('输入传送点个数:'))
m = int(input('输入朋友家位置:'))
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h = int(input('传送门' + str(c) + '起始点:'))
    e = int(input('传送门' + str(c) + '结束点:'))
    i += 1
    list1.append(h)
    list2.append(e)
else:pass
if list2[-1] >= m:
    print(list2[-1], m)
    if list1[0] == 0:
        while d < n:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if list2[d-1] >= list1[d]  and list1[d-1] >= list1[d] and list2[d-1] >= list2[d]:
               print('no')
               exit(0)
            elif list2[d-1] <= list1[d]  and list1[d-1] <= list1[d] and list2[d-1] <= list2[d]:
                print('yes')
                d += 1
            else:exit(0)
    else:print('No')
else: print('No')


num_teleports, destination = map(int, input("").split())
i = 0

location = 0
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
d = 0
c = 0
if end_points[-1] >= destination:
    if start_points[0] == 0:
        # while d < num_teleports:
        #     if start_points[d] <= location <= end_points[d]:
        #         c += 1
        #         if c == num_teleports:
        #             print("YES")
        #             exit(0)
        #         location = start_points[d+1]
        #     else:
        #         print("NO")
        #         exit(0)
        #     d += 1
        while d < num_teleports:
            if c == num_teleports - 1:
                if end_points[num_teleports-1] >= destination:
                    print("YES")
                    exit(0)
            if end_points[d] >= start_points[d + 1] >= location:
                c += 1
                location = start_points[d + 1]
            else:
                print("NO")
                exit(0)
            d += 1
    else:
        print('No')
        exit(0)
else:
    print('No')
    exit(0)


n, m = map(int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
Range = int()
while i < n:
    c += 1
    h, e = map(int, input().split())
    i += 1
    list1.append(h)
    list2.append(e)
if max(list2) >= m:
    if list1[0] == 0:
        Range = list2[d-1]
        while d <= n:
            if Range >= m:
                print('yes')
                exit(0)
            elif list2[d-1] >= list1[d] and Range <= list2[d]:
                Range = list2[d]
                d += 1
            elif list2[d-1] >= list1[d] and Range >= list2[d]:
                d += 1
            else:
                print('no')
                exit(0)
    else:
        print('No')
else:
    print('No')


n, m = (int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h, e = map(int, input().split())
    i += 1
    list1.append(h)
    list2.append(e)
if list2[-1] >= m:

    if list1[0] == 0:
        while d < n:
            if list2[d-1] >= list1[d] and list2[d-1] >= list2[d]:
               print('no')
               exit(0)
            elif list2[d-1] <= list1[d] and list2[d-1] <= list2[d]:
                print('yes')
                d += 1
            else:exit(0)
    else:print('No')
else: print('No')


num_teleports, destination = map(int, input("").split())
start_points = []
end_points = []
i = 0
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
max_length = end_points[0]
if start_points[0] != 1:
    print("No")
    exit(0)
for e in range(1, num_teleports):
    if start_points[e] <= max_length:
        max_length = max(end_points[e], max_length)
        continue
    else:
        print("No")
        exit(0)

if max_length >= destination:
    print("Yes")
    exit(0)
else:
    print("No")
    exit(0)


n, m = map(int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
flag = False
while i < n:
    c += 1
    h, e = map(int, input().split())
    i += 1
    list1.append(h)
    list2.append(e)
if list2[-1] >= m:
    if list1[0] == 0:
        while d < n:
            if flag:
                print('No')
                exit(0)
            elif list2[d-1] >= list1[d] and list2[d-1] <= list2[d]:
                d += 1
            else:
                flag = True
        else:
            print('yes')
            exit(0)
    else:
        print('No')
else:
    print('No')


n, m = map(int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h, e = map(int, input().split())
    i += 1
    list1.append(h)
    list2.append(e)
if list2[-1] >= m:
    if list1[0] == 0:
        while d < n:
            if list2[d-1] <= list1[d] and list2[d-1] <= list2[d]:
               d += 1
            elif d == n :
                print('yes')
                exit(0)
            else:
                print('no')
                exit(0)
    else:print('No')
else: print('No')


n, m = map(int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h = int(input('传送门' + str(c) + '起始点:'))
    e = int(input('传送门' + str(c) + '结束点:'))
    i += 1
    list1.append(h)
    list2.append(e)
# else:print('传送门起始位置：' + str(list1), '传送门结束位置：' + str(list2))
if list2[-1] >= m:
    # print(list2[-1], m)
    if list1[0] == 0:
        #  print(list1[d-1])
        #   print(list2[d])
        #   print(d)
        while d < n:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if list2[d - 1] >= list1[d] and list2[d - 1] >= list2[d]:
                print('No')
                exit(0)
            elif list2[d - 1] <= list1[d] and list2[d - 1] <= list2[d]:
                print('Yes')
                #           print(d)
                d += 1
            else:
                exit(0)
    else:
        print('No')
else:
    print('No')


num_teleports, destination = map(int, input("").split())
start_points = []
end_points = []
i = 0
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
if end_points[-1] >= destination:
    for e in range(1, num_teleports):
        if start_points[e - 1] <= start_points[e] <= end_points[e - 1]:
            continue
        else:
            print("No")
            exit(0)
else:
    print('No')
    exit(0)
print("Yes")
exit(0)


n, m = map(int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h, e = map(int, input().split())
    i += 1
    list1.append(h)
    list2.append(e)
if list2[-1] >= m:

    if list1[0] == 0:
        while d < n:
            if list2[d-1] >= list1[d] and list2[d-1] >= list2[d]:
               print('no')
               exit(0)
            elif list2[d-1] <= list1[d] and list2[d-1] <= list2[d]:
                print('yes')
                d += 1
            else:exit(0)
    else:print('No')
else: print('No')


num_teleports, destination = map(int, input("").split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d-1] <= end_points[d]:
                c += 1
                if c == num_teleports - 1:
                    print("YES")
            else:
                print("NO")
                break
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


num_teleports, destination = map(int, input().split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    c += 1
    h, e = map(int, input().split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d-1] <= end_points[d]:
                c += 1
                if c == 3:
                    print("YES")
                    break
                continue
            else:
                print("NO")
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


num_teleports, destination = map(int, input().split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    c += 1
    h, e = map(int, input().split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d-1] <= end_points[d]:
                c += 1
                if c == 3:
                    print("YES")
                    break
                continue
            else:
                print("NO")
    else:
        print('No')
else:
    print('No')
exit(0)


num_teleports, destination = map(int, input("num of teleports and destination point").split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    c += 1
    h, e = map(int, input("teleport start point and end point").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d - 1] >= end_points[d]:
                print('No')
                exit(0)
            elif end_points[d - 1] <= start_points[d] and end_points[d - 1] <= end_points[d]:
                if d == 2:
                    print('Yes')
                print('Yes')
                d += 1
                continue
            else:
                print('Noaaa')
                exit(0)
    else:
        print('No')
else:
    print('No')


num_teleports, destination = map(int, input("").split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d-1] <= end_points[d]:
                c += 1
                if c == 2:
                    print("YES")
            else:
                print("NO")
            d += 1
    else:
        print('No')
else:
    print('No')
exit(0)


n, m = map(int, input().split())
i = 0
c = 0
d = 1
list1 = []
list2 = []
while i < n:
    c += 1
    h, e = map(int, input().split())
    i += 1
    list1.append(h)
    list2.append(e)
if list2[-1] >= m:

    if list1[0] == 0:
        while d < n:
            if list2[d-1] >= list1[d] and list2[d-1] >= list2[d]:
               print('no')
               exit(0)
            elif list2[d-1] <= list1[d] and list2[d-1] <= list2[d]:
                print('yes')
                d += 1
            else:
                print('no')
                exit(0)
    else:print('No')
else: print('No')


num_teleports, destination = map(int, input("").split())
i = 0

location = 0
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
d = 0
c = 0
if end_points[-1] >= destination:
    if start_points[0] == 0:
        # while d < num_teleports:
        #     if start_points[d] <= location <= end_points[d]:
        #         c += 1
        #         if c == num_teleports:
        #             print("YES")
        #             exit(0)
        #         location = start_points[d+1]
        #     else:
        #         print("NO")
        #         exit(0)
        #     d += 1
        while d < num_teleports:
            if c == num_teleports - 1:
                if end_points[num_teleports-1] >= destination:
                    print("YES")
                    exit(0)
            if end_points[d] >= start_points[d + 1] >= location:
                c += 1
                location = start_points[d + 1]
            else:
                if d >= 5:
                    print(end_points)
                print("NO")
                exit(0)
            d += 1
    else:
        print('No')
        exit(0)
else:
    print('No')
    exit(0)


num_teleports, destination = map(int, input("").split())
start_points = []
end_points = []
i = 0
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
max_length = 0
if end_points[-1] >= destination:
    for e in range(1, num_teleports):
        if start_points[e - 1] <= start_points[e] <= end_points[e - 1]:
            max_length = max(end_points[e],max_length)
            continue
        else:
            print("No")
            exit(0)
else:
    print('No')
    exit(0)
if max_length >= destination:

    print("Yes")
    exit(0)
else:
    print("No")
    exit(0)


num_teleports, destination = map(int, input("num of teleports and destination point").split())
i = 0
c = 0
d = 1
start_points = []
end_points = []
while i < num_teleports:
    c += 1
    h, e = map(int, input("teleport start point and end point").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
# else:print('传送门起始位置：' + str(start_points), '传送门结束位置：' + str(end_points))
if end_points[-1] >= destination:
    # print(end_points[-1], m)
    if start_points[0] == 0:
        while d < num_teleports:
            # 1,2个条件限制后一个传送门起始位置在前一个门范围内3,限制后传送门为前进
            if end_points[d - 1] >= start_points[d] and end_points[d - 1] >= end_points[d]:
                print('No')
                exit(0)
            elif end_points[d - 1] <= start_points[d] and end_points[d - 1] <= end_points[d]:
                if d == 2:
                    print('Yes')
                d += 1
                continue
            else:
                print('No')
                exit(0)
    else:
        print('No')
else:
    print('No')


num_teleports, destination = map(int, input("").split())
i = 0

location = 0
start_points = []
end_points = []
while i < num_teleports:
    h, e = map(int, input("").split())
    i += 1
    start_points.append(h)
    end_points.append(e)
d = 0
c = 0
if end_points[-1] >= destination:
    if start_points[0] == 0:
        # while d < num_teleports:
        #     if start_points[d] <= location <= end_points[d]:
        #         c += 1
        #         if c == num_teleports:
        #             print("YES")
        #             exit(0)
        #         location = start_points[d+1]
        #     else:
        #         print("NO")
        #         exit(0)
        #     d += 1
        while d < num_teleports:
            if c == num_teleports - 1:
                if end_points[num_teleports-1] >= destination:
                    print("YES")
                    exit(0)
            if end_points[d] >= start_points[d + 1] >= location:
                c += 1
                location = start_points[d + 1]
            else:
                if d >= 5:
                    print(start_points)
                    print(end_points)
                print("NO")
                exit(0)
            d += 1
    else:
        print('No')
        exit(0)
else:
    print('No')
    exit(0)


a = int(input('输入传送点个数:'))
b = int(input('输入朋友家位置:'))
i = 0
c = 0
n = 1
list1 = []
list2 = []
while i < a:
    c += 1
    h = int(input('传送门' + str(c) + '起始点:'))
    e = int(input('传送门' + str(c) + '结束点:'))
    i += 1
    list1.append(h)
    list2.append(e)
# print('传送门起始位置：' + str(list1), '传送门结束位置：' + str(list2))
if list2[-1] >= b:
     #print(list2[-1], b)
    if list1[0] == 0:
       # print(list1[n-1])
       # print(list2[n])
       # print(n)
        while n < a:
            if list2[n-1] >= list1[n] and list2[n-1] < list2[n]:
                pass
                n += 1
            #print(n)
            else:print('No')
        if n == a:
            print('Yes')
    else:print('No')
else: print('No')


n , m = map(int, input().split())
a = []
for i in range(n):
    x1, x2 = map(int, input().split())
    a.append([x1, x2])
z = 0
for i in range(n):
    if a[i][0] == z and m > a[i][1] and i < n - 1 and a[i + 1][0] <= a[i][1]:
        z = a[i + 1][0]
    elif a[i][0] == z and m <= a[i][1]:
        z = m
        break
    elif a[i][0] > z and i < n - 1 and a[i + 1][0] > a[i][1]:
        break
    elif i == n - 1 and m <= a[i][1] and z == a[i][0]:
        z = m
if z == m:
    print('YES')
else:
    print('NO')


n , m = map(int, input().split())
a = []
for i in range(n):
    x1, x2 = map(int, input().split())
    a.append([x1, x2])
z = 0
zb = a[0][1]
for i in range(n):
    if a[i][0] <= z and m > zb and i < n - 1 and a[i + 1][0] <= zb and a[i + 1][1] >= zb:
        z = a[i + 1][0]
        zb = a[i + 1][1]
    elif a[i][0] <= z and m > zb and i < n - 1 and a[i + 1][0] <= zb and a[i + 1][1] < zb:
        z = zb
    elif a[i][0] == z and m <= zb:
        z = m
        break
    elif a[i][0] > z and i < n - 1 and a[i + 1][0] > zb:
        break
    elif i == n - 1 and m <= zb and z == a[i][0]:
        z = m
if z == m:
    print('YES')
else:
    print('NO')


n , m = map(int, input().split())
a = []
for i in range(n):
    x1, x2 = map(int, input().split())
    a.append([x1, x2])
a.sort()
z = 0
for i in range(n):
    if a[i][0] <= z and m > a[i][1]:
        z = a[i][1]
    elif a[i][0] <= z and m <= a[i][1]:
        z = m
        break
    elif a[i][0] > z:
        break
if z == m:
    print('YES')
else:
    print('NO')


MaxN = 128

def read():
    return [int(v) for v in input().split()]

def main():
    n, m = read()

    a = []
    for _ in range(n):
        a.append(read())

    a.sort(key=lambda v: v[0])

    highest_val = 0
    for (start, end) in a:
        if start > highest_val:
            print('NO')
            return
        highest_val = max(highest_val, end)

    if highest_val <= m:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()


MaxN = 128

def read():
    return [int(v) for v in input().split()]

def main():
    n, m = read()

    a = []
    for _ in range(n):
        a.append(read())

    a.sort(key=lambda v: v[0])

    highest_val = 0
    for (start, end) in a:
        if start > highest_val:
            print('NO')
            return
        highest_val = max(highest_val, end)

    if highest_val >= m:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()


n, m = input().split()
n, m = int(n), int(m)

f = 0
y = 1
for i in range(n):
	a, b = input().split()
	a, b = int(a), int(b)
	if i == 0:
		x = b
	else:
		if a > x:
			print("NO")
			f = 1
			break
		x = max(x, b)
	y = min(y , a)
if f == 0:
	if x >= m and y == 0:
		print("YES")
	else:
		print("NO")


n, m = input().split()
n, m = int(n), int(m)

y = 1
for i in range(n):
	a, b = input().split()
	a, b = int(a), int(b)
	if i == 0:
		x = b
	else:
		if a > x:
			print("NO")
			exit()
		x = max(x, b)
	y = min(y , a)
if x >= m and y == 0:
	print("YES")
else:
	print("NO")


n, m = input().split()
n, m = int(n), int(m)

f = 0
for i in range(n):
	a, b = input().split()
	a, b = int(a), int(b)
	if i == 0:
		x = b
	else:
		if a > x:
			print("NO")
			f = 1
			break
		x = b
if f == 0:
	if x >= m:
		print("YES")
	else:
		print("NO")


n, m = input().split()
n, m = int(n), int(m)

f = 0
for i in range(n):
	a, b = input().split()
	a, b = int(a), int(b)
	if i == 0:
		x = b
	else:
		if a > x:
			print("NO")
			f = 1
			break
		x = max(x, b)
if f == 0:
	if x >= m:
		print("YES")
	else:
		print("NO")


n,m=input().split(' ')
n=int(n)
m=int(m)
c=[]
for i in range(0,n):
    a,b=input().split(' ')
    a=int(a)
    b=int(b)
    c.append([a,b])
a1=c[0][0]
a2=0
for i in range(1,n):
    if c[i][0]<=c[i-1][1]:
        a2=c[i][1]
    else:
        break
if a1<=m<=a2 or m==0:
    print('YES')
else:
    print('NO')


n,m=input().split(' ')
n=int(n)
m=int(m)
c=[]
for i in range(0,n):
    a,b=input().split(' ')
    a=int(a)
    b=int(b)
    c.append([a,b])
c.sort()
s=2
a1=c[0][0]
if a1!=0:
    s=0
a2=c[0][1]
for i in range(1,n):
    if c[i][0]<=a2 and c[i][1]>=a2:
        a2=c[i][1]
    elif c[i][0]>a2:
        break
    if a2>=m:
        s=1
        break
if s==1:
    print('YES')
else:
    print('NO')


n,m=input().split(' ')
n=int(n)
m=int(m)
c=[]
for i in range(0,n):
    a,b=input().split(' ')
    a=int(a)
    b=int(b)
    c.append([a,b])
c.sort()
s=2
hh=1
a1=c[0][0]
if a1!=0:
    hh=0
a2=c[0][1]
for i in range(1,n):
    if c[i][0]<=a2 and c[i][1]>=a2:
        a2=c[i][1]
    elif c[i][0]>a2:
        break
if a2>=m:
    s=1
s=s*hh
if s==1:
    print('YES')
else:
    print('NO')


n,m=input().split(' ')
n=int(n)
m=int(m)
c=[]
for i in range(0,n):
    a,b=input().split(' ')
    a=int(a)
    b=int(b)
    c.append([a,b])
c.sort()
s=2
a1=c[0][0]
if a1!=0:
    s=0
a2=c[0][1]
for i in range(1,n):
    if c[i][0]<=a2 and c[i][1]>=a2:
        a2=c[i][1]
    elif c[i][0]>a2:
        break
if a2>=m:
    s=1
if s==1:
    print('YES')
else:
    print('NO')


n,m=input().split(' ')
n=int(n)
m=int(m)
c=[]
for i in range(0,n):
    a,b=input().split(' ')
    a=int(a)
    b=int(b)
    c.append([a,b])
c.sort()
s=2
a1=c[0][0]
if a1!=0:
    s=0
a2=0
for i in range(1,n):
    if c[i][0]<=c[i-1][1]:
        a2=c[i][1]
        if a2>=m:
            s=1
            break
    else:
        break
if s==1:
    print('YES')
else:
    print('NO')


n,m=input().split(' ')
n=int(n)
m=int(m)
c=[]
for i in range(0,n):
    a,b=input().split(' ')
    a=int(a)
    b=int(b)
    c.append([a,b])
c.sort()
a1=c[0][0]
a2=0
for i in range(1,n):
    if c[i][0]<=c[i-1][1]:
        a2=c[i][1]
    else:
        break
if a1<=m<=a2 or m==0:
    print('YES')
else:
    print('NO')


# n = int(input("The number of teleports[1,100]: "))
# m = int(input("The location of the friend's house[1,100]: "))
n,m = map(int, input("The number of teleports and the location of the friend's house:").split())

x = 1
l = []
while 1 <= x <= n:
    # tele = int(input("The index of teleports: "))
    # limit = int(input("The limit of this teleport: "))
    tele, limit = map(int, input().split())
    for i in range(limit):
        l.append(i)
    x += 1

i = 1
while 1<= i <= m:
    if i in l:
        i += 1
    else:
        print("NO")
        exit(0)

print("YES")


n = int(input("The number of teleports[1,100]: "))
m = int(input("The location of the friend's house[1,100]: "))

x = 1
l = []
while 1 <= x <= n:
    tele = int(input("The index of teleports: "))
    limit = int(input("The limit of this teleport: "))
    for i in range(limit):
        l.append(i)
    x += 1

i = 1
while 1<= i <= m:
    if i in l:
        i += 1
    else:
        print("NO")
        exit(0)

print("YES")


axis = [0]*105
n, m = map(int, input().split())
for _ in range(n):
    x, y = map(int, input().split())
    axis[x+1:y+1] = [1]*(y-x)
for i in range(1, m+1):
    if not axis[i]:
        print("No")
        exit(0)
print("YES")


n,m = map(int, input().split())
x = 1
l = []
while 1 <= x <= n:
    tele, limit = map(int, input().split())
    for i in range(limit-tele):
        l.append(tele + i)
    x += 1

i = 1
while 1<= i <= m:
    if i in l:
        i += 1
    else:
        print("NO")
        exit(0)

print("YES")


axis = [0]*105 #创建数组 数轴
n, m = map(int, input('numbers and address:').split())
# 使用map()将每个元素依次转换为int型，储存为list类型。再分别赋值(见书)
for _ in range(n):
# 用_来做变量！！！[0,n)??? 只是表示数量n个
    x, y = map(int, input('input').split())
    axis[x+1:y+1] = [1]*(y-x)
    # 成员检测：把0变成1，看是否覆盖位置
for i in range(1, m+1):
    if not axis[i]:
        # 如果第i个不为1？？？
        print("No")
        exit(0)
print("YES")


n,m = map(int, input().split())
x = 1
l = []
while 1 <= x <= n:
    tele, limit = map(int, input().split())
    for i in range(limit):
        l.append(tele + i)
    x += 1

i = 1
while 1<= i <= m:
    if i in l:
        i += 1
    else:
        print("NO")
        exit(0)

print("YES")


# n = int(input("The number of teleports[1,100]: "))
# m = int(input("The location of the friend's house[1,100]: "))
n,m = map(int, input("The number of teleports and the location of the friend's house:").split())

x = 1
l = []
while 1 <= x <= n:
    # tele = int(input("The index of teleports: "))
    # limit = int(input("The limit of this teleport: "))
    tele, limit = map(int, input().split())
    for i in range(limit):
        l.append(tele + i)
    x += 1

i = 1
while 1<= i <= m:
    if i in l:
        i += 1
    else:
        print("NO")
        exit(0)

print("YES")


def canReach(teleports, loc):
    prevx, prevy = teleports.pop(0)
    if len(teleports) == 0:
        if prevy >= loc and prevx==0:
            print('YES')
        else:
            print('NO')
        return
    for x, y in teleports:
        if x <= prevy and y >= loc:
            print('YES')
            return
        elif x > prevy:
            print('NO')
            return
        elif prevy < y:
            prevy = y
    if prevy!=loc:
        print('NO')
    elif prevy == loc:
        print('YES')

def main():
    n, loc = list(map(int, input().split()))
    teleports = []
    for i in range(n):
        teleports.append(tuple(map(int, input().split())))
    canReach(teleports, loc)

main()


def canReach(teleports, loc):
    prevx, prevy = teleports.pop(0)
    if len(teleports) == 0:
        if prevy == loc:
            print('YES')
        else:
            print('NO')
        return
    for x, y in teleports:
        if x <= prevy and y == loc:
            print('YES')
            return
        elif x > prevy:
            print('NO')
            return
        else:
            prevy = y

def main():
    n, loc = list(map(int, input().split()))
    teleports = []
    for i in range(n):
        teleports.append(tuple(map(int, input().split())))
    canReach(teleports, loc)

main()


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

#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
const ll mod =1e9+7;
const int N = 100005;

ll v[N];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>v[i];
	}
	ll ans=0;
	vector<vector<ll>> dp(n+1, vector<ll>(n+1));
	for(int l=2; l<=n; l++){
		for(int i=0; i<(n-l+1); i++){
			int j=i+l-1;
			if(l%2==0) dp[i][j]=dp[i][j-1]+abs(v[j-1]-v[j]);
			else dp[i][j]=dp[i][j-1]-abs(v[j-1]-v[j]);
			ans=max(dp[i][j],ans);
		}
	}
	cout<<ans<<endl;

	return 0;
}


#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <chrono>
#include <map>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <fstream>
#include <numeric>
#include <functional>
#include <exception>
#include <set>
#include <queue>
#include <string_view>
#include <stack>
#include <functional>
#include <type_traits>
#include <optional>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <array>

using ll = long long;

#ifdef _WIN32
#include <intrin.h>
#define is_windows_t true
#else
#define is_windows_t false
#endif

ll buildin_one_count(ll number)
{
#ifdef _WIN32
		return __popcnt(number);
#else
		return __builtin_popcountl(number);
#endif
}

ll bits_count(ll number)
{
	return static_cast<ll>(log2(number)) + 1;
}

template <class Container>
ll lsize(const Container& container)
{
	return static_cast<ll>(size(container));
}

using namespace std;

constexpr ll MOD = 1'000'000'000 + 7;
constexpr ll INF = numeric_limits<ll>::max();

namespace segment_tree_ns
{
	template <class T, class binary_func>
	class segment_tree
	{
	public:
		segment_tree(const std::vector<T>& elems)
			: tree_(4 * size(elems)), binary_op_(binary_func{}), tree_size_(size(elems))
		{
			static_assert(
				std::is_constructible_v<std::function<T(T, T)>, binary_func>,
				"wrong binary_func arg : it must be convertible to std::function<T(T, T)>");

			build(elems, 1, 0, tree_size_ - 1);
		}

		T get_value(size_t left, size_t right) const
		{
			auto opt_value = get_value_int(1, 0, tree_size_ - 1, left, right);
			if (opt_value.has_value())
				return opt_value.value();

			throw std::runtime_error("logical error : left > right");
		}

		void update(size_t pos, T new_value)
		{
			update_int(1, 0, tree_size_ - 1, pos, new_value);
		}
	private:
		void build(const std::vector<T>& cont, size_t vertex, size_t left, size_t right)
		{
			if (left == right)
			{
				tree_[vertex] = cont[left];
			}
			else
			{
				size_t center = (left + right) / 2;
				build(cont, vertex * 2, left, center);
				build(cont, vertex * 2 + 1, center + 1, right);
				tree_[vertex] = binary_op_(tree_[vertex * 2], tree_[vertex * 2 + 1]);
			}
		}

		std::optional<T> get_value_int(size_t vertex, size_t tree_left, size_t tree_right, size_t left, size_t right) const
		{
			if (left > right)
				return std::nullopt;
			if (left == tree_left && right == tree_right)
				return tree_[vertex];
			size_t center = (tree_left + tree_right) / 2;

			auto first = get_value_int(vertex * 2, tree_left, center, left, std::min(right, center));
			auto second = get_value_int(vertex * 2 + 1, center + 1, tree_right, std::max(left, center + 1), right);
			if (first.has_value() && second.has_value())
				return binary_op_(first.value(), second.value());
			else if (first.has_value())
				return first.value();
			else
				return second.value();
		}

		void update_int(size_t vertex, size_t tree_left, size_t tree_right, size_t pos, T new_value)
		{
			if (tree_left == tree_right)
			{
				tree_[vertex] = new_value;
			}
			else
			{
				size_t center = (tree_left + tree_right) / 2;
				if (pos <= center)
					update_int(vertex * 2, tree_left, center, pos, new_value);
				else
					update_int(vertex * 2 + 1, center + 1, tree_right, pos, new_value);
				tree_[vertex] = binary_op_(tree_[vertex * 2], tree_[vertex * 2 + 1]);
			}
		}
	private:
		std::vector<T> tree_;
		const size_t tree_size_;
		std::function<T(T, T)> binary_op_;
	};

	template <class T>
	using sum_segment_tree = segment_tree<T, std::plus<T>>;

	template <class T>
	struct max_s
	{
		T operator()(T lhs, T rhs) const { return std::max<T>(lhs, rhs); }
	};
	template <class T>
	using max_segment_tree = segment_tree <T, max_s<T>>;

	template <class T>
	struct min_s
	{
		T operator()(T lhs, T rhs) const { return std::min<T>(lhs, rhs); }
	};
	template <class T>
	using min_segment_tree = segment_tree<T, min_s<T>>;
}

using namespace segment_tree_ns;

namespace range_ns
{
	class xrange
	{
		class Iterator
		{
		public:
			using iterator_category = std::random_access_iterator_tag;
			using value_type = ll;
			using difference_type = ll;
			using pointer = ll;
			using reference = void;

			Iterator(ll i) : m_i(i) {}
			ll operator++ () { return ++m_i; }
			ll operator*() { return m_i; }
			bool operator!=(const Iterator& it) const { return m_i != it.m_i; }
			bool operator==(const Iterator& it) const { return m_i == it.m_i; }
			difference_type operator-(const Iterator& it) const { return m_i - it.m_i; }
		private:
			ll m_i;
		};

		ll m_begin = 0;
		ll m_end;

	public:
		xrange(ll n) : m_end(n) {}
		xrange(ll l, ll r) : m_begin(l), m_end(r) {}
		Iterator begin() const { return Iterator(m_begin); }
		Iterator end() const { return Iterator(m_end); }
	};

	template <typename T, typename = void>
	struct has_push_back : std::false_type {};

	template <typename T>
	struct has_push_back<T, std::void_t<decltype(std::declval<T>().push_back(std::declval<T::value_type>()))>> : std::true_type {};

	template <typename T>
	constexpr bool has_push_back_v = has_push_back<T>::value;

	template<class Container>
	void print(const Container& container, const char* sep = "\n")
	{
		std::copy(container.begin(), container.end(), ostream_iterator<typename Container::value_type>(cout, sep));
	}

	template<class Container, class Compare = std::less<typename Container::value_type>>
	void sort(Container& container, Compare compare = Compare())
	{
		std::sort(container.begin(), container.end(), compare);
	}

	template<class Container, class T>
	decltype(auto) find(Container& container, const T& elem)
	{
		return std::find(container.begin(), container.end(), elem);
	}

	template<class Container, class Condition>
	decltype(auto) find_if(Container& container, Condition condition)
	{
		return std::find_if(container.begin(), container.end(), condition);
	}

	template<class Container, class Condition = std::less<typename Container::value_type>>
	decltype(auto) cmax_element(const Container& container, Condition condition = Condition())
	{
		return std::max_element(container.begin(), container.end(), condition);
	}

	template<class Container, class Condition = std::less<typename Container::value_type>>
	decltype(auto) cmin_element(const Container& container, Condition condition = Condition())
	{
		return std::min_element(container.begin(), container.end(), condition);
	}

	template<class Container, class Condition = std::less<typename Container::value_type>>
	decltype(auto) max_element(Container& container, Condition condition = Condition())
	{
		return std::max_element(container.begin(), container.end(), condition);
	}

	template<class Container, class Condition = std::less<typename Container::value_type>>
	decltype(auto) min_element(Container& container, Condition condition = Condition())
	{
		return std::min_element(container.begin(), container.end(), condition);
	}

	template<class Container, class Condition = std::less<typename Container::value_type>>
	decltype(auto) minmax_element(const Container& container, Condition condition = Condition())
	{
		return std::minmax_element(container.begin(), container.end(), condition);
	}

	template<class Container, class Condition>
	decltype(auto) any_of(const Container& container, Condition condition)
	{
		return std::any_of(container.begin(), container.end(), condition);
	}

	template<class Container, class Condition>
	decltype(auto) all_of(const Container& container, Condition condition)
	{
		return std::all_of(container.begin(), container.end(), condition);
	}

	template<class Container, class T>
	decltype(auto) count(const Container& container, const T& elem)
	{
		return std::count(container.begin(), container.end(), elem);
	}

	template<class Container, class Condition>
	decltype(auto) count_if(const Container& container, Condition condition)
	{
		return std::count_if(container.begin(), container.end(), condition);
	}

	template<class Container, class T, class Compare = std::less<typename Container::value_type>>
	decltype(auto) equal_range(const Container& container, const T& elem, Compare compare = Compare())
	{
		return std::equal_range(container.begin(), container.end(), elem, compare);
	}

	template<class Container, class T, class Compare = std::less<typename Container::value_type>>
	decltype(auto) lower_bound(const Container& container, const T& elem, Compare compare = Compare())
	{
		return std::lower_bound(container.begin(), container.end(), elem, compare);
	}

	template<class Container, class T>
	decltype(auto) upper_bound(const Container& container, const T& elem)
	{
		return std::upper_bound(container.begin(), container.end(), elem);
	}

	template<class Container, class T>
	void erase_remove(Container& container, const T& elem)
	{
		container.erase(remove(container.begin(), container.end(), elem), container.end());
	}

	template<class Container, class Condition>
	void erase_remove_if(Container& container, Condition condition)
	{
		container.erase(remove_if(container.begin(), container.end(), condition), container.end());
	}

	template<class Container, class Condition>
	Container copy_if(const Container& container, Condition condition)
	{
		Container container_result;
		if constexpr (has_push_back_v<container_result>)
		{
			container_result.reserve(size(container));
			std::copy_if(container.begin(), container.end(), back_inserter(container_result), condition);
		}
		else
		{
			std::copy_if(container.begin(), container.end(), inserter(container_result, end(container_result)), condition);
		}
		return container_result;
	}

	template <class Container>
	void reverse(Container& container)
	{
		std::reverse(begin(container), end(container));
	}

	struct sum_functor
	{
		ll operator()(ll sum, ll value) const { return sum + value; }
	};

	template<class Container, class Func = sum_functor, class T = ll>
	T reduce(const Container& container, T init_value = T(), Func func = sum_functor())
	{
		return std::accumulate(container.begin(), container.end(), init_value, func);
	}

	template<class Container, class Func = std::equal_to<typename Container::value_type>>
	decltype(auto) adjacent_find(const Container& container, Func func = Func())
	{
		return std::adjacent_find(container.begin(), container.end(), func);
	}

	template<class InContainer, class OutContainer, class TransformFunction>
	void transform(const InContainer& i_container, OutContainer& o_container, TransformFunction i_transform_function)
	{
		if constexpr (has_push_back_v<OutContainer>)
		{
			o_container.reserve(size(i_container) + size(o_container));
			std::transform(i_container.begin(), i_container.end(), std::back_inserter(o_container), i_transform_function);
		}
		else
		{
			std::transform(i_container.begin(), i_container.end(), std::inserter(o_container, end(o_container)), i_transform_function);
		}
	}

	template <class Container>
	decltype(auto) enumerate(const Container& container)
	{
		using return_type = vector<pair<typename Container::value_type, ll>>;
		return_type out_container;
		const ll n = lsize(container);
		out_container.reserve(n);
		for (ll i : xrange(n))
			out_container.emplace_back(container[i], i);

		return out_container;
	}

	template <class Container, class PredicateCompare = equal_to<typename Container::value_type>>
	void erase_unique(Container& container, PredicateCompare compare = PredicateCompare())
	{
		container.erase(
			std::unique(
				begin(container),
				end(container),
				compare),
			end(container));
	}

	template <class Container, class SearchT>
	decltype(auto) search(Container& container, const SearchT& to_search)
	{
		return std::search(
			begin(container),
			end(container),
			begin(to_search),
			end(to_search)
		);
	}

	template <class Container, class Compare = std::less<typename Container::value_type>>
	bool binary_search(const Container& container, typename Container::value_type& elem, Compare compare = Compare())
	{
		return std::binary_search(cbegin(container), cend(container), elem);
	}

	template <class Container>
	Container partial_sum(const Container& i_container)
	{
		Container o_container;
		o_container.reserve(size(i_container));
		std::partial_sum(cbegin(i_container), cend(i_container), std::back_inserter(o_container));
		return o_container;
	}

	template <class Container, class Func>
	vector<ll> partial_sum(const Container& i_container, Func i_func)
	{
		if (empty(i_container))
			return vector<ll>();
		vector<ll> o_container(size(i_container));
		o_container[0] = i_func(i_container[0]);
		for (ll i : xrange(1, size(i_container)))
			o_container[i] = o_container[i - 1] + i_func(i_container[i]);
		return o_container;
	}
}

using namespace range_ns;

auto sort_by_first = [](const auto& lhs, const auto& rhs)
{
	return get<0>(lhs) < get<0>(rhs);
};

auto sort_by_second = [](const auto& lhs, const auto& rhs)
{
	return get<1>(lhs) < get<1>(rhs);
};

template <class T>
decltype(auto) read_vector(ll n)
{
	vector<T> res(n);
	for (auto& i : res)
		cin >> i;
	return res;
}

using factorization_map = unordered_map<ll, ll>;

// factorize
factorization_map factorize(ll n)
{
	factorization_map ans;

	while (n % 2 == 0)
	{
		++ans[2];
		n = n / 2;
	}

	for (ll i = 3; i <= sqrt(n); i = i + 2)
	{
		while (n % i == 0)
		{
			++ans[i];
			n = n / i;
		}
	}

	// n is prime
	if (n > 2)
		++ans[n];

	return ans;
};

ll ceil_div(ll n, ll k)
{
	return static_cast<ll>(ceil(static_cast<double>(n) / k));
}

using graph = vector<vector<ll>>;
using weight_graph = vector<vector<pair<ll, ll>>>;

ll bfs(const graph& g, ll vertex, ll value, vector<bool>& visited, ll& count)
{
	visited[vertex] = true;
	stack<ll> q;
	q.push(vertex);

	while (!empty(q))
	{
		ll s = q.top();
		q.pop();
		for (ll v : g[s])
		{
			if (visited[v])
				continue;

			visited[v] = true;
			q.push(v);
		}
	}

	return 0;
}

void debth_first_search(const graph& graph, ll start_vertex, ll end_vertex)
{
	stack<ll> vertex_stack;
	vertex_stack.push(start_vertex);
	vector<bool> visited(size(graph), false);
	visited[start_vertex] = true;

	vector<ll> path(size(graph), -1);
	while (!vertex_stack.empty())
	{
		ll vertex = vertex_stack.top();
		vertex_stack.pop();

		for (ll v : graph[vertex])
			if (!visited[v])
			{
				visited[v] = true;
				vertex_stack.push(v);
				path[v] = vertex;
			}
	}

	vector<ll> path_end_start = { end_vertex };
	ll vertex = -1;
	while (vertex != start_vertex)
	{
		vertex = path[path_end_start.back()];
		path_end_start.push_back(vertex);
	}

	range_ns::reverse(path_end_start);
}

vector<ll> topological_sort(const graph& g)
{
	ll n = lsize(g);
	vector<bool> used(n, false);
	vector<ll> ans;
	ans.reserve(n);

	function<void(ll)> topological_sort_dfs;
	topological_sort_dfs = [&g, &used, &ans, &topological_sort_dfs](ll v)
	{
		used[v] = true;
		for (ll vertex : g[v])
			if (!used[vertex])
				topological_sort_dfs(vertex);
		ans.push_back(v);
	};

	for (int i = 0; i < n; ++i)
		if (!used[i])
			topological_sort_dfs(i);

	reverse(ans);
	return ans;
}

class disjoint_set_union
{
public:
	disjoint_set_union(ll n) : m_parent(vector<ll>(n, -1)), m_unions(vector<vector<ll>>(n))
	{
		for (ll i : xrange(n))
		{
			make_set(i);
			m_unions[i].push_back(i);
		}
	}

	void union_sets(ll a, ll b)
	{
		a = find_set(a);
		b = find_set(b);
		if (a != b)
		{
			if (lsize(m_unions[a]) < lsize(m_unions[b]))
				swap(a, b);

			auto& unions_a = m_unions[m_parent[a]];
			auto& unions_b = m_unions[m_parent[b]];
			unions_a.insert(end(unions_a), cbegin(unions_b), cend(unions_b));
			vector<ll>().swap(unions_b);

			m_parent[b] = a;
		}
	}

	bool in_different_sets(ll a, ll b)
	{
		return find_set(a) != find_set(b);
	}

	const vector<ll>& get_union() const
	{
		return *find_if(m_unions, [](const auto& vec) { return !empty(vec); });
	}

private:
	void make_set(ll v)
	{
		m_parent[v] = v;
	}

	ll find_set(ll v)
	{
		if (v == m_parent[v])
			return v;
		return m_parent[v] = find_set(m_parent[v]);
	}

private:
	vector<ll> m_parent;
	vector<vector<ll>> m_unions;
};

using weight_edge = tuple<ll, ll, ll>;
using mst_pair = pair<ll, vector<pair<ll, ll>>>;

weight_graph minimum_spanning_tree_kruskal(vector<weight_edge>& weight_edges, ll n)
{
	weight_graph g(n);
	sort(weight_edges, sort_by_first);
	disjoint_set_union dsu(n);

	for (auto[weight, i, j] : weight_edges)
	{
		if (dsu.in_different_sets(i, j))
		{
			g[i].emplace_back(weight, j);
			g[j].emplace_back(weight, i);
			dsu.union_sets(i, j);
		}
	}

	return g;
}

weight_graph minimum_spanning_tree_prim(const weight_graph& g)
{
	const ll n = lsize(g);
	weight_graph mst(n);
	vector<bool> processed(n, false);

	priority_queue<tuple<ll, ll, ll>> pq_edges;
	pq_edges.emplace(0, 0, -1);

	while (!empty(pq_edges))
	{
		auto[weight, vertex, from] = pq_edges.top();
		pq_edges.pop();
		if (processed[vertex])
			continue;
		processed[vertex] = true;
		if (from != -1)
		{
			mst[vertex].emplace_back(-weight, from);
			mst[from].emplace_back(-weight, vertex);
		}
		for (auto[weight, to] : g[vertex])
			pq_edges.emplace(-weight, to, vertex);
	}

	return mst;
}

class least_common_ancestor
{
public:
	least_common_ancestor(const weight_graph& g)
	{
		try
		{
			const ll n = lsize(g);
			m_pre_processing.resize(n);
			ll log_n = static_cast<ll>(ceil(log2(n))) + 1;
			for (auto& v : m_pre_processing)
				v.resize(log_n);
			m_vertex_depths.resize(n);

			vector<bool> visited(n);
			visited[0] = true;
			stack<ll> q;
			q.push(0);

			while (!empty(q))
			{
				ll s = q.top();
				q.pop();
				for (auto[weight, v] : g[s])
				{
					if (visited[v])
						continue;

					m_vertex_depths[v] = m_vertex_depths[s] + 1;
					m_pre_processing[v][0] = { weight, s };
					visited[v] = true;
					q.push(v);
				}
			}

			for (ll j = 1; j < log_n; ++j)
			{
				for (ll i = 0; i < n; ++i)
				{
					auto[weight, ancestor] = m_pre_processing[i][j - 1];
					m_pre_processing[i][j].first = max(weight, m_pre_processing[ancestor][j - 1].first);
					m_pre_processing[i][j].second = m_pre_processing[ancestor][j - 1].second;
				}
			}
		}
		catch (exception& ex)
		{
			cout << ex.what();
		}
	}

	pair<ll, ll> get(ll i, ll j)
	{
		try
		{
			if (m_vertex_depths[i] > m_vertex_depths[j])
				swap(i, j);

			ll max_weight = -INF;
			while (m_vertex_depths[j] != m_vertex_depths[i])
			{
				ll previous_up = 0, up = 0;
				while (m_vertex_depths[m_pre_processing[j][up].second] > m_vertex_depths[i])
					previous_up = up++;

				auto[weight, ancestor] = m_pre_processing[j][previous_up];
				j = ancestor;
				max_weight = max(max_weight, weight);
			}

			// now i and j on the same height
			while (m_pre_processing[i][0].second != m_pre_processing[j][0].second)
			{
				ll previous_up = 0, up = 0;
				while (m_pre_processing[i][up].second != m_pre_processing[j][up].second)
					previous_up = up++;

				max_weight = max(max_weight, max(m_pre_processing[i][previous_up].first, m_pre_processing[j][previous_up].first));
				i = m_pre_processing[i][previous_up].second;
				j = m_pre_processing[j][previous_up].second;
			}

			if (i != j)
				max_weight = max(max_weight, max(m_pre_processing[i][0].first, m_pre_processing[j][0].first));
			return pair(max_weight, m_pre_processing[i][0].second);
		}
		catch (exception& ex)
		{
			cout << ex.what();
			return { -1, -1 };
		}
	}

private:
	using weight_ancestor_pair = pair<ll, ll>;
	vector<vector<weight_ancestor_pair>> m_pre_processing;
	vector<ll> m_vertex_depths;
};

vector<ll> dijkstra(const weight_graph& g, ll v)
{
	const ll n = lsize(g);
	vector<ll> distances(n, INF);
	vector<bool> processed(n, false);

	priority_queue<pair<ll, ll>> pq_edges;
	pq_edges.emplace(0, v);
	while (!empty(pq_edges))
	{
		ll vertex = pq_edges.top().second;
		pq_edges.pop();
		if (processed[vertex])
			continue;
		processed[vertex] = true;
		for (auto[weight, to] : g[vertex])
		{
			if (distances[vertex] + weight < distances[to])
			{
				distances[to] = distances[vertex] + weight;
				pq_edges.emplace(-distances[to], to);
			}
		}
	}

	return distances;
}

bool cycle_exist_in_oriented_graph(const graph& g)
{
	enum class vertex_state
	{
		not_processed,
		is_processing,
		processed
	};

	const ll n = lsize(g);
	vector<vertex_state> states(n, vertex_state::not_processed);
	function<bool(ll)> dfs;
	dfs = [&dfs, &g, &states](ll vertex) -> bool
	{
		if (states[vertex] == vertex_state::is_processing)
			return true;
		else if (states[vertex] == vertex_state::processed)
			return false;

		states[vertex] = vertex_state::is_processing;
		for (ll v : g[vertex])
			if (dfs(v))
				return true;
		states[vertex] = vertex_state::processed;
		return false;
	};

	for (ll i : xrange(n))
		if (dfs(i))
			return true;
	return false;
}

graph read_graph(ll n, ll m, bool is_oriented = false)
{
	graph g(n);
	for (ll k : xrange(m))
	{
		ll i, j;
		cin >> i >> j;
		--i;
		--j;
		g[i].push_back(j);
		if (!is_oriented)
			g[j].push_back(i);
	}

	return g;
}

ll bin_pow_mod(ll a, ll b)
{
	if (a == 0)
		return 0;

	if (b == 0)
		return 1;

	if (b % 2)
	{
		return (a * bin_pow_mod(a, b - 1)) % MOD;
	}
	else
	{
		ll tmp = bin_pow_mod(a, b / 2);
		return (tmp * tmp) % MOD;
	}
}

vector<int> z_function(string_view s)
{
	int n = (int)s.length();
	vector<int> z(n);
	for (int i = 1, l = 0, r = 0; i < n; ++i) {
		if (i <= r)
			z[i] = min(r - i + 1, z[i - l]);
		while (i + z[i] < n && s[z[i]] == s[i + z[i]])
			++z[i];
		if (i + z[i] - 1 > r)
			l = i, r = i + z[i] - 1;
	}
	return z;
}

int find_fisrt_occurance(const string& t, const string& p)
{
	auto vec = z_function(p + "#" + t);
	for (int i = 0; i < lsize(t); ++i)
		if (vec[i + lsize(p) + 1] == lsize(p))
			return i;

	return -1;
}

ll count_distinct_subsequnces(string_view s)
{
	vector<ll> dp_alphabet(26);
	for (ll i : xrange(lsize(s)))
		dp_alphabet[s[i] - 'a'] = (1 + reduce(dp_alphabet)) % MOD;

	return (1 + reduce(dp_alphabet)) % MOD;
};

ll max_sum_segment(const std::vector<ll>& i_vec)
{
	ll min_sum = 0, sum = 0, ans = -INF;
	for (ll val : i_vec)
	{
		sum += val;
		ans = max(ans, sum - min_sum);
		min_sum = min(min_sum, sum);
	}
	return ans;
}

int main(int argc, char** argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll n;
	cin >> n;
	auto vec = read_vector<ll>(n);
	vector<ll> evens(n - 1);
	vector<ll> odds(n - 2);
	for (ll i : xrange(n - 1))
	{
		evens[i] = (i % 2 ? -1 : 1) * abs(vec[i + 1] - vec[i]);
		if (i != 0)
			odds[i - 1] = (i % 2 ? 1 : -1) * abs(vec[i + 1] - vec[i]);
	}

	cout << max(max_sum_segment(evens), max_sum_segment(odds));
	return 0;
}