## Napping

View as PDF

Points: 15 (partial)
Time limit: 1.0s
Memory limit: 256M

Authors:
Problem type

Joe loves sleeping. He loves it so much that he’ll take naps whenever and wherever possible. He is currently on a car ride with his parents, which will be minutes long. During the trip, there will be events at distinct times that will wake Joe up if he is sleeping during those times. Joe plans to take up to naps during these minutes, and since he loves uniformity, he wants them all to be of the same length. Joe wishes to know the maximum number of minutes he can nap during the ride.

#### Input Specification

The first line will contain three integers and .

The second line will contain space separated integers, .

#### Output Specification

Output on a single line the maximum number of minutes Joe can sleep.

#### Sample input

22 2 5
6 17

#### Sample output

20

#### Explanation

The best options is to take four 5-minute long naps during intervals , , , and .