#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <algorithm>
using namespace std;

//check if points are collinear or not
bool check_collinear(int x1, int y1, int x2, int y2, int x3, int y3){
    int a = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
    if (a == 0)
        return true;
    else
        return false;
}
bool solve(string n, int l)
{

    // Less than three digit number
    // can be checked directly.
    if (l < 3) {
        if (stoi(n) % 8 == 0)
            return true;

        // check for the reverse of a number
        reverse(n.begin(), n.end());
        if (stoi(n) % 8 == 0)
            return true;
        return false;
    }

    // Stores the Frequency of characters in the n.
    int hash[10] = { 0 };
    for (int i = 0; i < l; i++)
        hash[n[i] - '0']++;
    
    for (int i = 104; i < 1000; i += 8) {

        int dup = i;

        int freq[10] = { 0 };
        freq[dup % 10]++;
        dup = dup / 10;
        freq[dup % 10]++;
        dup = dup / 10;
        freq[dup % 10]++;

        dup = i;

        if (freq[dup % 10] > hash[dup % 10])
            continue;
        dup = dup / 10;

        if (freq[dup % 10] > hash[dup % 10])
            continue;
        dup = dup / 10;

        if (freq[dup % 10] > hash[dup % 10])
            continue;

        return true;
    }

    // when all are checked its not possible
    return false;
}

int main(){
    string number;
    getline(cin, number);
    int l = number.length();

    if (solve(number, l))
        cout << "Yes";
    else
        cout << "No";
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  string S; cin >> S;

  string ans = "No";
  vector<ll> d(10, 0);
  for (ll i = 0; i < S.size(); i++) {
    d[S[i] - '0']++;
  }

  if (S.size() == 1) {
    if (S[0] == '8') ans = "Yes";

  } else if (S.size() == 2) {
    if (S == "16") ans = "Yes";
    if (S == "24") ans = "Yes";
    if (S == "32") ans = "Yes";
    if (S == "48") ans = "Yes";
    if (S == "56") ans = "Yes";
    if (S == "64") ans = "Yes";
    if (S == "72") ans = "Yes";
    if (S == "88") ans = "Yes";
    if (S == "96") ans = "Yes";
    if (S == "61") ans = "Yes";
    if (S == "42") ans = "Yes";
    if (S == "23") ans = "Yes";
    if (S == "84") ans = "Yes";
    if (S == "65") ans = "Yes";
    if (S == "46") ans = "Yes";
    if (S == "27") ans = "Yes";
    if (S == "69") ans = "Yes";
  } else {
    for (ll x = 1; x < 125; x++) {
      ll eight = 8 * x;
      vector<ll> d2(10, 0);
      for (ll i = 0; i < 3; i++) {
        d2[eight % 10]++;
        eight /= 10;
      }
      bool ok = true;
      for (ll i = 0; i < 10; i++) {
        if (d[i] < d2[i]) ok = false;
      }
      if (ok) {
        ans = "Yes";
      }
    }
  }

  cout << ans << '\n';
  return 0;
}