#include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
for(int i = 0; i < s.length() - 1; i++)
{
if (s[i] == '4' && s[i + 1] == '7')
{
cout << "YES\n";
return 0;
}
}
cout << "NO\n";
}