Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/funksiya-vaqt-farqi

Difference between two times

Easy 1000 ms 128 MB 21%
Share

Write a function TimeDiff(h1, m1, s1, h2, m2, s2) that returns how many seconds pass from $h_{1}$ hours $m_{1}$ minutes $s_{1}$ seconds to $h_{2}$ hours $m_{2}$ minutes $s_{2}$ seconds of the same day.

Example 1: TimeDiff(8, 30, 0, 10, 15, 30) → 6330 — $1$ hour $45$ minutes $30$ seconds have passed.

Example 2: TimeDiff(12, 0, 0, 12, 0, 0) → 0

Write only the function body.

The hours, minutes and seconds of two times go into the function TimeDiff, which returns the number of seconds between them

Input

One line with six non-negative integers $h_{1}$, $m_{1}$, $s_{1}$, $h_{2}$, $m_{2}$ and $s_{2}$ — the arguments of the function.

Output

The value returned by the function: an integer.

Note

$0 \le h_{1}, h_{2} \le 23$
$0 \le m_{1}, m_{2}, s_{1}, s_{2} \le 59$
The second time is not earlier than the first.

Examples

Input #1
8 30 0 10 15 30
Output #1
6330
Input #2
12 0 0 12 0 0
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.