/* -*- coding: utf-8 -*- * * 842.cc: No.842 初詣 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int N = 6; const int cs[N] = { 500, 100, 50, 10, 5, 1 }; /* typedef */ /* global variables */ int ds[N]; /* subroutines */ /* main */ int main() { for (int i = 0; i < N; i++) scanf("%d", ds + i); int g; scanf("%d", &g); for (int i = 0; i < N; i++) g -= cs[i] * min(ds[i], g / cs[i]); if (g == 0) puts("YES"); else puts("NO"); return 0; }