#include using namespace std; typedef long long ll; #define REP(i,n) for(int i=0; i #define VLL vector #define VVI vector> #define VVLL vector> #define VC vector #define VS vector #define VVC vector> #define VB vector #define VVB vector> #define fore(i,a) for(auto &i:a) typedef pair P; template bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1 << 30; const ll INFL = 1LL << 60; const ll mod = 998244353; bool dp[8000]; int main() { int a, b, c, d, e, f, g; cin >> a >> b >> c >> d >> e >> f >> g; a++, b++, c++, d++, e++, f++; dp[0] = true; for (int i = 7000; i >= 0; i--) { FOR(j, 1, a) { if (i - j * 500 >= 0) { if (dp[i - j*500])dp[i] = true; } } } for (int i = 7000; i >= 0; i--) { FOR(j, 1, b) { if (i - j * 100 >= 0) { if (dp[i - j*100])dp[i] = true; } } } for (int i = 7000; i >= 0; i--) { FOR(j, 1, c) { if (i - j * 50 >= 0) { if (dp[i - j*50])dp[i] = true; } } } for (int i = 7000; i >= 0; i--) { FOR(j, 1, d) { if (i - j * 10 >= 0) { if (dp[i - j*10])dp[i] = true; } } } for (int i = 7000; i >= 0; i--) { FOR(j, 1, e) { if (i - j * 5 >= 0) { if (dp[i - j * 5])dp[i] = true; } } } for (int i = 7000; i >= 0; i--) { FOR(j, 1, f) { if (i - j * 1 >= 0) { if (dp[i - j * 1])dp[i] = true; } } } if (dp[g])cout << "YES" << endl; else cout << "NO" << endl; }