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.
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.
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.
A single line that contains the minimal number of keystrokes needed to update the current time to the new time on the alarm clock.
Input:
6
30
7
25
Output:
6
Input:
23
58
5
30
Output:
34