There is no doubt that everybody that has ever been on a long flight to either the east or the west, is familiar with the phenomenon of jet lag. During the day you feel tired and you want to sleep and overnight you are awake in bed. However, your biorhythm is adjusted to the circumstances in a few days. To calculate the amount of days $$d$$ it takes to recover from jet lag, the International Civil Aviation Organisation (ICAO) developed the following formula \[ d = \frac{\frac{u}{2} + (z-3) + v + a}{10} \] $$u$$ is the number of flight hours of the trip, and $$z$$ is the amount of timezones passed. The time of departure $$v$$ and the time of arrival $$a$$ are calculated based on the tables underneath.
departure between | $$v$$ |
---|---|
8:00 en 12:00 | 0 |
12:00 en 18:00 | 1 |
18:00 en 22:00 | 3 |
22:00 en 01:00 | 4 |
01:00 en 08:00 | 5 |
arrival between | $$a$$ |
---|---|
8:00 en 12:00 | 4 |
12:00 en 18:00 | 2 |
18:00 en 22:00 | 0 |
22:00 en 01:00 | 1 |
01:00 en 08:00 | 3 |
In the borders that are used to determine $$v$$ and $$a$$, departure time is always excluded and arrival time is always included. Departure and arrival times are always displayed in local time. Suppose that you are flying from New York Kennedy Airport to London Heathrow. Your flight leaves at 7:00 local time in New York and arrives at 19:00 local time in London. Knowing that it is 5 hours later in London, we have \[ \begin{aligned} u & = 7 \\ z & = 4 \\ v & = 5 \\ a & = 0 \end{aligned} \] Based on the ICAO formula, you need 0,95 days to recover from jet lag \[ d = \frac{\frac{7}{2} + (4-3) + 5 + 0}{10} = \frac{3,5 + 1 + 5 + 0}{10} = \frac{9,5}{10} = 0,95 \]
The input consists of 4 lines that each contain a natural number, the respective values $$u$$, $$z$$, departure time and time of arrival. The times of departure and arrival are rounded off to the closest hour.
One line stating the number of days it takes to recover from jet lag after a flight of which the parameters are described in the input.
Input:
7
4
7
19
Output:
0.95