Олимпиадный тренинг

Задача 33655. Olympics at Hogwarts


Hogwarts hosts the traditional annual Olympiad in the theory of magic among junior students. School manager Argus Filch was assigned to distribute students to classrooms.

Each faculty put up their best students for the Olympiad. From Gryffindor G students, from Slytherin S students, Hufflepuff represents H students and Ravenclaw —  R students. Filch has M audiences at his disposal. The classrooms have been given a special expansion spell, so they can accommodate any number of students if needed. When seating, it is necessary to take into account that students of the same faculty, who are in the same audience, can take advantage of the opportunity to start cheating, exchanging ideas for solving problems. Therefore, in any classroom, the number of students from one faculty who fall into it should be minimized. Let's call a seating arrangement that satisfies this requirement optimal.

Help me calculate what is the minimum number of students from the same faculty who still have to be seated in the same classroom, even with optimal seating.

Input: The first line contains four integers GSH< /em> and R (1 ≤ G, S, H , R ≤ 1000) — the number of students representing each of the faculties of the school.

The second line contains an integer M (1 ≤ M ≤ 1000) — the number of classes Filch has at his disposal.

Output: Print the minimum number of students from the same department that Filch will have to seat in the same room even with optimal seating.
Examples

# Input Output
1 4 3 4 4
2
2
2 15 14 13 14
3
5

Запрещенные операторы:max;min