A digital alarm clock displays time as a 24-hour clock. The time displayed by the clock can be updated using four keys that separately modify the hour and minute settings. There are two keys to increase or decrease the hour setting with a single unit, where the value 23 is immediately followed by 0. There are two keys to increase or decrease the minute setting with a single unit, where the value 59 is immediately followed by 0.

alarm clock
A digital alarm clock displays time as a 24-hour clock and is currently set to 23:58. The clock has separate keys to increment or decrement the hour and minut settings. It takes at least 34 key strokes to update the clock so that it displays the time 05:30.

For a given time that is currently displayed on the digital alarm clock, determine the minimal number of keystrokes it takes to update the time to a new given time.

Input

Four positive integers, each on a separate line. The first two lines respectively contain the hours $$h_0 \in \mathbb{N}$$ $$(0 \leq h \leq 23)$$ and the minutes $$m_0 \in \mathbb{N}$$ $$(0 \leq m \leq 59)$$ that are currently displayed on a digital alarm clock. The last two lines respectively contain the hours $$h_1 \in \mathbb{N}$$ $$(0 \leq h \leq 23)$$ and the minutes $$m_1 \in \mathbb{N}$$ $$(0 \leq m \leq 59)$$ of the new time that needs to be displayed on the alarm clock.

Output

A single line that contains the minimal number of keystrokes needed to update the current time to the new time on the alarm clock.

Example

Input:

6
30
7
25

Output:

6

Example

Input:

23
58
5
30

Output:

34