#include <iostream>
#include <bits/stdc++.h>

using namespace std;

#define with_test(t, isT) int t=1;if(isT)cin>>t;while(t--)
void init(){
    #ifndef ONLINE_JUDGE    
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);   
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);    cin.tie(0);    cout.precision(10);
    cout << fixed;
}

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) 
#define for1(i, n) for (int i = 1; i < (int)(n); ++i)
#define YES  cout<<"YES\n";
#define YESC cout<<"YES\n";continue;
#define NO   cout<<"NO\n";
#define NOC  cout<<"NO\n";continue;

#define pb push_back
#define mp make_pair

#define fe first
#define se second
#define lld long long int
#define ll  long long

void print(vector<int> arr){
    for0(i,arr.size()){
        cout<<arr[i]<<" ";
    }
    cout<<"\n";
}
void print(int arr[], int n){
    for0(i, n){
        cout<<arr[i]<<" ";
    }cout<<"\n";
}

void test_case(){
    string s;
    cin>>s;
    reverse(s.begin(), s.end());
    for(int i=0;i<s.length();i++){
        if(s[i]=='6'){
            cout<<"9";
        }
        else if(s[i]=='9'){
            cout<<"6";
        }else{
            cout<<s[i];
        }
    }
}

int main() {
    init();
    int isTest = 0;
    with_test(t,isTest){
        test_case();
    }
    return 0;
}
/*
    ====== WORK =====


*/

#include<bits/stdc++.h>
/*#include<boost/multiprecision/cpp_int.hpp>
using boost :: multiprecision::cpp_int;*/
#define ll long long int
#define mod 1e9+7
using namespace std;
/*int gcd(int a, int b)
{
  if (a == 0)
    return b;
  return gcd(b % a, a);
}*/


void solve()
{
  string n;
  cin >> n;
  for (int i = n.length() - 1; i >= 0; i--)
  {
    if (n[i] == '0')
    {
      n.erase(i);
    }
    else
    {
      break;
    }
  }
  ll l = n.length();
  bool check = true;
  for (int i = 0; i < l / 2; i++)
  {
    if (n[i] != n[l - i - 1])
    {
      check = false;
    }

  }
  if (check)
  {
    cout << "Yes";
  }
  else
  {
    cout << "No";
  }
}

int main()
{

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;

}


