/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID

#include <bits/stdc++.h>

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define ll long long
#define MP make_pair
#define ERR cout << "================================================\n"
#define fi first
#define se second
#define PB push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n)-1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define print(v)          \
    for (auto x : v)      \
    {                     \
        cout << x << " "; \
    }
#define umin(...) min({__VA_ARGS__})
#define umax(...) max({__VA_ARGS__})
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define SP << " " <<
#define W(t)  \
    ll t;     \
    cin >> t; \
    while (t--)
#define FIO                           \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const ll INF = 1e18;
const ll NEG_INF = -1 * (1e18);
using namespace std;

void usaco(string prob)
{
    freopen((prob + ".in").c_str(), "r", stdin);
    freopen((prob + ".out").c_str(), "w", stdout);
}

/* Function to check primality in O(sqrt(n)) */
bool prime(int n)
{
    if (n < 2)
        return false;
    for (int x = 2; x * x <= n; x++)
    {
        if (n % x == 0)
            return false;
    }
    return true;
}

/* Function to get prime factorization of n */
vector<int> getFactors(int n)
{
    vector<int> f;
    for (int x = 2; x * x <= n; x++)
    {
        while (n % x == 0)
        {
            f.push_back(x);
            n /= x;
        }
    }
    if (n > 1)
        f.push_back(n);
    return f;
}

void solve()
{
    string x;
    cin >> x;
    ll pt = 0;
    reverse(all(x));
    while (pt < x.length() && x[pt] != '.')
    {
        ++pt;
    }
    if (pt >= x.length())
    {
        reverse(all(x));
        cout << x << "\n";
    }
    else
    {
        string ans = "";
        for (ll i = pt + 1; i < x.length(); i++)
        {
            ans += x[i];
        }
        reverse(all(ans));
        cout << ans << "\n";
    }
}

int main()
{
    //FIO
    FAST

        //usaco("cowlands");

        ll TC = 1;
    /*
	Uncomment when multiple test cases
	*/

    //cin >> TC;
    for1(tt, TC)
    {
        solve();
    }
    return 0;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 2e5;
char s[maxN + 1];
map<int, int> cnt;

int main()
{
  while (scanf(" %s", s) != EOF)
  {
    cnt.clear();
    int n = strlen(s);
    for (int i = 0; i < n; i++)
    {
      int val = s[i] - '0';
      if (!cnt.count(val))
        cnt[val] = 0;
      cnt[val]++;
    }

    if (n == 1)
      printf("%s\n", s[0] == '8' ? "Yes" : "No");
    else if (n == 2)
    {
      int a = s[0] - '0', b = s[1] - '0';
      bool is = (10*a + b) % 8 == 0 || (10*b + a) % 8 == 0;
      printf("%s\n", is ? "Yes" : "No");
    }
    else
    {
      /*
      The last three digits are divisible by 8.

      Add four times the hundreds digit to twice the tens digit to the ones digit. The result must be divisible by 8.
      */
      vector<int> digits;
      for (auto i: cnt)
        for (int j = 0; j < min(i.second, 3); j++)
          digits.push_back(i.first);

      bool can = false;
      for (int i = 0; i < digits.size(); i++)
        for (int j = i + 1; j < digits.size(); j++)
          for (int k = j + 1; k < digits.size(); k++)
          {
            vector<int> hehe = {digits[i], digits[j], digits[k]};
            sort(hehe.begin(), hehe.end());
            do
            {
              int num = hehe[0]*4 + hehe[1]*2 + hehe[2];
              if (num % 8 == 0)
                can = true;
            } while (next_permutation(hehe.begin(), hehe.end()));
          }
      printf("%s\n", can ? "Yes" : "No");
    }
  }
  return 0;
}