#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

int main() {
  string s;
  cin >> s;
  vector<int> v(10);
  int sz = s.size();
  for (int i = 0; i < sz; i++) {
    int idx = s[i] - '0';
    v[idx]++;
  }
  debug(v);
  if (sz == 1) {
    if (s == "8")
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    return 0;
  }
  vector<string> vs = {"16", "61", "24", "42", "32", "23", "48", "84", "56",
                       "65", "64", "46", "72", "27", "88", "96", "69"};
  if (sz == 2) {
    for (auto a : vs) {
      if (a == s) {
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
    return 0;
  }
  for (int i = 104; i < 1000; i += 8) {
    bool break_flag = false;
    vector<int> v_tmp = v;
    string tmp = to_string(i);
    debug(tmp);
    for (int j = 0; j < 3; j++) {
      if (v_tmp[tmp[j] - '0'] <= 0) {
        break_flag = true;
        break;
      }
      v_tmp[tmp[j] - '0']--;
    }
    debug(v_tmp);
    if (!break_flag) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define maxe              *max_element
#define mine              *min_element
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl
#define see(x)            cout<<#x<<" = "<<x<<endl
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    string s; cin>>s;

    if(s.sz==1)
    {
        if(s=="8") cout<<"Yes";
        else cout<<"No";
        return 0;
    }

    set<ll>two, three;

    for(ll i=10;i<=99;i++) if(i%8==0) two.insert(i);
    for(ll i=100;i<=999;i++) if(i%8==0) three.insert(i);

    if(s.sz==2)
    {
        for(auto i:two)
        {
            string k=s;
            reverse(all(k));
            ll a,b;
            a=stoi(s);
            b=stoi(k);
            if(a%8==0 || b%8==0)
            {
                cout<<"Yes"; return 0;
            }
        }

        cout<<"No"; return 0;
    }

    //for(auto i:three) cout<<i<<" "; cout<<endl;

    for(auto i:three)
    {
        string now=to_string(i);
        string k=s;
        ll f=0;
        //see(now);

        for(ll i=0;i<now.sz;i++)
        {
            for(ll j=0;j<k.sz;j++)
            {
                if(now[i]==k[j])
                {
                    //cout<<k<<" ";
                    k[j]='X'; f++; break;
                    //cout<<k<<endl<<endl;
                }
            }
        }

        if(f==3)
        {
            cout<<"Yes"; return 0;
        }
    }

    cout<<"No"; return 0;
}



















