#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdint.h>
#include <iomanip>
using namespace std;

using uint = unsigned int;
using ll = long long;

#define CIN( LL , A ) LL A; cin >> A 
#define GETLINE( A ) string A; getline( cin , A ) 
#define FOR_ITR( ARRAY , ITR , END ) for( auto ITR = ARRAY .begin() , END = ARRAY .end() ; ITR != END ; ITR ++ ) 

int main()
{

  CIN( string , S );
  const uint& size = S.size();
  ll num = -1;
  
  for( uint i = 0 ; i < size ; i++ ){

    const string c = S.substr( i , 1 );

    if( c == "5" ){

      if( num == 1 ){

	cout << "YES" << endl;
	return 0;
	
      }

      num = 0;

    } else if( c == "7" ){

      if( num == 0 ){

	num = 1;

      } else {

	num = -1;

      }

    } else {

      num = -1;

    }

  }
  
  cout << "NO" << endl;
  return 0;

}