#include<bits/stdc++.h>
using namespace std;
int main(){
	int i,p=0,s=0;
	string w;
	cin>>w;
	for(i=0;i<w.size();i++) if(w[i]!=7)s+=w[i];
    for(i=0;i<w.size();i++) p+=w[i];
    int detail=p-s;
    if(detail!=0&&detail%7==0) cout<<"Yes";
    else cout<<"No";
	return 0;
}