On the first day of every school year, the principal of a primary school must sort the newly enrolled pupils into classes and assign one teacher to each class. She wants to use as few teachers as possible.
She knows how many pupils are enrolled in each of the seven grades, from Kindergarten up to year 6. Pupils must be placed into classes according to the following rules:
Given the enrolment numbers, compute the minimum number of teachers required.
The input contains several test cases. Each test case is a single line of seven non-negative integers: the number of pupils enrolled in Kindergarten, year 1, year 2, year 3, year 4, year 5, and year 6, in that order. Every integer is less than 200, and consecutive integers are separated by a single space.
A line containing seven zeros marks the end of the input and must not be processed.
For each test case, print a single line containing one integer: the minimum number of teachers required.