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 crates of red dust, crates of white dust, crates of black dust, crates of yellow dust, or 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 crates of red dust, crates of white dust, crates of black dust, crates of yellow dust, and crates of green dust, how many cars will not be in use on a train with cars if Weiss loads the train optimally?
Input Specification
The first line of input will contain the single integer . The next line of input will contain 5 space-separated integers , , , , and .
Output Specification
A single integer, the number of empty cars on the train.
Sample Input
70
8 10 12 10 10
Sample Output
57
Comments