#include using namespace std; int main(){ int a, b, c, d, e, f, g; cin >> a >> b >> c >> d >> e >> f >> g; if(500*a+100*b+50*c+10*d+5*e+f == g) { cout << "YES" << endl; } else{ cout << "NO" << endl; } return 0; }