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

// #include <ext/pb_ds/assoc_container.hpp> //required
// #include <ext/pb_ds/tree_policy.hpp> //required

// using namespace __gnu_pbds; //required

// template <typename T> using ordered_set =  tree<T, null_type, less<T>,
// rb_tree_tag, tree_order_statistics_node_update>;

// ordered_set <int> s;
// s.find_by_order(k); returns the (k+1)th smallest element
// s.order_of_key(k); returns the number of elements in s strictly less than k

#pragma GCC optimize("-Ofast")
#pragma GCC optimize("trapv")
#pragma GCC target(                                                            \
	"sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
#define mod (1000000000+7)
#define pii pair<ll, ll>
#define vi vector<int>
#define vvi vector<vector<int>>
#define f first
#define s second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define all(x) x.begin(), x.end()
#define print(vec, l, r)                                                       \
	for (int i = l; i <= r; i++)                                               \
		cout << vec[i] << " ";                                                 \
	cout << endl;
#define forf(i, a, b) for (int i = (a); i < (b); i++)
#define forr(i, a, b) for (ll i = (a); i > (b); i -= 1)
#define input(vec, N) for (int i = 0; i < (N); i++) cin >> vec[i];                                            
typedef long long ll;
#define ld long double
const int N = 1<<18;
const int MAXK = 12;
const ll INF = 2000000000000000000;

const int RANDOM =
	chrono::high_resolution_clock::now().time_since_epoch().count();
// struct chash {
//     int operator()(int x) const { return x ^ RANDOM; }
// };
// gp_hash_table<int, unsigned long long, chash> m[12];

ll expo_pow(ll x, ll y) {
	if (y == 0)
		return 1;
	y = y % (mod - 1);
	x %= mod;
	if (y == 0)
		y = mod - 1;
	ll res = 1;
	while (y) {
		if (y & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		y >>= 1;
	}
	return res;
}

ll modInverse(ll a, ll m = mod) {
	return expo_pow(a, m - 2);
}




void solve (int te){
    string s;
    cin>>s;

    int cnt[10];
    memset(cnt,0,sizeof(cnt));
    for(auto x : s){
      cnt[x-'0']++;
    }

    forf(i,100,1000){
      if(i%8==0){
        int tcnt[10];
        forf(i,0,10) tcnt[i] = cnt[i];

        int j = i;
        int f=0;
        while(j){
          if(!tcnt[j%10]){
            f=1;
            break;
          }
          else tcnt[j%10]--;
          j/=10;
        }
        if(!f){
          cout<<"Yes"<<'\n';
          return;
        }
      }
    }

    forf(i,0,100){
      if(i%8==0){
        int tcnt[10];
        forf(i,0,10) tcnt[i] = cnt[i];

        int j = i;
        int f=0;
        while(j){
          if(!tcnt[j%10]){
            f=1;
            break;
          }
          else tcnt[j%10]--;
          j/=10;
        }

        forf(i,0,10){
          if(tcnt[i]){
            f=1;
            break;
          }
        }

        if(!f){
          cout<<"Yes"<<'\n';
          return;
        }
      }
    }


    cout<<"No"<<'\n';



}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int T = 1;
	// freopen("f.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	//cin >> T;
  int t=1;
	// sieve();
	while (t<=T) {
		solve(t);
    t++;
	}
}
#include <bits/stdc++.h>

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>         vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)            for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

int main() {
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

  vi start = {0, 8, 16, 104};
  string s;
  cin >> s;
  vi cnt(10, 0), cnt2(10, 0);
  each(c, s) cnt[c - '0']++;
  bool ok = false;
  int n = s.length();
  for (int i = start[min(n, 3)];i < 1000 and !ok;i += 8) {
    string t = to_string(i);
    each(c, t) {
      cnt2[c - '0']++;
    }
    if (!cnt2[0]) {
      ok = true;
      loop(10) {
        if (cnt2[i] > cnt[i]) ok = false;
      }
    }
    each(c, t) cnt2[c - '0']--;
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

