package main import "fmt" func main() { var A, B, C, D, E, F, G int fmt.Scan(&A, &B, &C, &D, &E, &F, &G) for i := 0; i <= A; i++ { for j := 0; j <= B; j++ { for k := 0; k <= C; k++ { for l := 0; l <= D; l++ { for m := 0; m <= E; m++ { for n := 0; n <= F; n++ { if 500*i+100*j+50*k+10*l+5*m+1*n == G { fmt.Println("YES") return } } } } } } } fmt.Println("NO") }