#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  string s;
  cin >> s;
  bool b=false;
  for(int i=0; i < s.length(); i++){
    if(s.substr(i, 3) == "575")
      b = true;
  }
  if(b)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}