#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair; using pll = pair; using vi = vector; using vl = vector; using vvi = vector; using vvl = vector; const int INF = 1 << 28; const ll MOD = 1000000007; template bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; } template bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; } int main() { vector coins = {500, 100, 50, 10, 5, 1}; vector nums(6); for (int i = 0; i < 6; ++i) { cin >> nums[i]; } int g; cin >> g; for (int i = 0; i < 6; ++i) { while (nums[i] > 0 && g > 0) { if (g >= coins[i]) { nums[i]--; g -= coins[i]; } else { break; } } } if (g == 0) { cout << "YES" << "\n"; } else { cout << "NO" << "\n"; } return 0; }