#include using namespace std; typedef long long ll; int main() { int m[6] = {500, 100, 50, 10, 5, 1}; vector n(6); for (int i = 0; i < 6; ++i) cin >> n[i]; int g; cin >> g; for (int i = 0; i < 6; ++i) { while (n[i] > 0 && g >= m[i]) { g -= m[i]; n[i]--; } } string ans = g == 0? "YES": "NO"; cout << ans << '\n'; return 0; }