#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int n = s.size();
  bool dp[n + 1][8];
  memset(dp, false, sizeof(dp));
  string ans[8];
  for (int i = 1; i < n + 1; i++) {
    string temp_ans[8];
    dp[i][(s[i - 1] - '0') % 8] = true;
    temp_ans[(s[i - 1] - '0') % 8] = s[i - 1];
    for (int j = 0; j < 8; j++) {
      if (dp[i - 1][j]) {
        int temp = (10 * j + (s[i - 1] - '0')) % 8;
        dp[i][temp] = true;
        temp_ans[temp] = ans[j] + s[i - 1];
        dp[i][j] = true;
        temp_ans[j] = ans[j];
      }
    }
    for (int j = 0; j < 8; j++) ans[j] = temp_ans[j];
  }
  if (dp[n][0]) {
    cout << "YES\n";
    cout << ans[0] << endl;
  } else
    cout << "NO\n";
}
