text: #include <bits/stdc++.h>
  #define FOR(i,a,b)  for(int (i)=(a);(i)<(b);(i)++)
  #define REP(i,n)    FOR(i,0,n)
  #define RER(i,n)    FOR(i,0,(n+1))
  #define pb          push_back
  #define mp(a,b)     make_pair((a),(b))
  #define mset(m,v)   memset(m,v,sizeof(m))
  using namespace std;
  typedef vector<int> vi;
  typedef pair<int, int> pii;
  typedef vector<pair<int, int> > vpii;
  typedef long long ll;
  typedef vector<ll> vl;
  typedef pair<ll,ll> pll;
  typedef vector<pair<ll, ll> > vpll;
  typedef vector<string> vs;
  typedef long double ld;
  const double EPS    = 1e-10;
  const int INF       = 1e+9;
  const double PI     = acos(-1);
  
  
  auto main() -> int
  {
      string n, n2;
      cin >> n;
  
      n2 = n;
      reverse(begin(n), end(n));
  
      bool f1 = true, f2 = true;
      FOR(i, 1, 3) {
         if ( n[i] != n[0] ) {
              f1 = false;
         }
         if ( n2[i] != n2[0] ) {
              f2 = false;
         }
      }
  
      if ( f1 || f2 ) {
          cout << "Yes" << endl;
      } else {
          cout << "No" << endl;
      }
  
      return 0;
  }
  
  