Weiss is the head of a company that exports dust across the continent by train. However, dust can be very unstable (and highly explosive in large quantities). Depending on the type of dust, only a few crates of it can be loaded onto one car. One train in particular will be transporting five types of dust.
To meet safety regulations, one car may carry up to ~4~ crates of red dust, ~5~ crates of white dust, ~4~ crates of black dust, ~3~ crates of yellow dust, or ~6~ crates of green dust. Different types of dust cannot be loaded into the same car. It is possible that all dust crates may not fit on the train, in which case there will be no empty cars (but leftover crates).
Given ~R~ crates of red dust, ~W~ crates of white dust, ~B~ crates of black dust, ~Y~ crates of yellow dust, and ~G~ crates of green dust, how many cars will not be in use on a train with ~C~ cars if Weiss loads the train optimally?
The first line of input will contain the single integer ~C~ ~(1 \le C \le 1\,000)~. The next line of input will contain 5 space-separated integers ~R~, ~W~, ~B~, ~Y~, and ~G~ ~(0 \le R, W, B, Y, G \le 100)~.
A single integer, the number of empty cars on the train.
70 8 10 12 10 10