#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() #define dunk(a) cout << (a) << endl using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b, c, d, e, f, g; cin >> a >> b >> c >> d >> e >> f >> g; rep(i, a + 1) { rep(j, b + 1) { rep(k, c + 1) { rep(l, d + 1) { rep(m, e + 1) { rep(n, f + 1) { if (500 * i + 100 * j + 50 * k + 10 * l + 5 * m + n == g) { puts("YES"); return 0; } } } } } } } puts("NO"); return 0; }