Problem:
 Score : 100 points    Problem Statement In this problem, we use the 24 -hour clock.  Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2 . (See Sample Inputs below for clarity.)
He has decided to study for K consecutive minutes while he is up.
What is the length of the period in which he can start studying?      Constraints  0 \le H_1, H_2 \le 23  0 \le M_1, M_2 \le 59  The time H_1 : M_1 comes before the time H_2 : M_2 .  K \ge 1  Takahashi is up for at least K minutes.  All values in input are integers (without leading zeros).         Input Input is given from Standard Input in the following format:  H_1  M_1  H_2  M_2  K       Output Print the length of the period in which he can start studying, as an integer.        Sample Input 1 10 0 15 0 30      Sample Output 1 270  Takahashi gets up at exactly ten in the morning and goes to bed at exactly three in the afternoon.
It takes 30 minutes to do the study, so he can start it in the period between ten o'clock and half-past two. The length of this period is 270 minutes, so we should print 270 .       Sample Input 2 10 0 12 0 120      Sample Output 2 0  Takahashi gets up at exactly ten in the morning and goes to bed at exactly noon. It takes 120 minutes to do the study, so he has to start it at exactly ten o'clock. Thus, we should print 0 .

Solution (Python):
H1,M1,H2,M2,K = map(int,input().split())
h1 = 60*H1+M1
h2 = 60*H2+M2
print(h2-h1-K)

Solution (Python):

H1,M1,H2,M2,K=map(int,input().split())

T=(H2-H1)*60+M2-M1

print(max(0,T-K))

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())

A = 60 * H1 + M1
B = 60 * H2 + M2
print(B - A - K)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
h = h2 - h1
if m2 >= m1:
    m = m2 - m1
else:
    m = m2 + 60 - m1
    h -= 1
ans = h * 60 + m - k
if ans <= 0 :
    ans = 0
print(ans)

Solution (Python):
h1,m1,h2,m2,k=map(int, input().split())

print((h2-h1)*60+(m2-m1)-k)

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())

S = 60 * H1 + M1
E = 60 * H2 + M2
print(E-S-K)

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())

print(h2*60 + m2 - h1*60 - m1 - k)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

H1, M1, H2, M2, K = map(int, input().split())


if M2 - M1 >= 0:
    tmp = (H2-H1) * 60 + (M2-M1)
else:
    tmp = (H2-H1-1) * 60 + 60+M2-M1

print(tmp - K)

Solution (Python):
h1, m1, h2, m2, k = map(int,input().split())

if m1 > m2:
    x = (h2 - h1 - 1)*60 + m2 - m1 + 60 - k

else:
    x = (h2 - h1)*60 + m2 - m1- k

print(x)

Solution (Python):
def main():
    H1, M1, H2, M2, K = map(int, input().split())

    start_min = H1 * 60 + M1
    end_min = H2 * 60 + M2 - K


    possible_min = end_min - start_min
    print(possible_min)

main()

Solution (Python):

h1,m1,h2,m2,k = map(int,input().split())
a = 60-m1 + (h2-h1-1)*60+m2
print(max(a-k,0))

Solution (Python):
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))


def main():
	H1, M1, H2, M2, K = getlist()
	X = H2 * 60 + M2 - (H1 * 60 + M1)
	print(X - K)

if __name__ == '__main__':
	main()

Solution (Python):
b0=input().split()
h1=int(b0[0])
m1=int(b0[1])
h2=int(b0[2])
m2=int(b0[3])
k=int(b0[4])

time=(h2-h1)*60+m2-m1-k
print(time)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())




t1=60*h1+m1
t2=60*h2+m2
t3=t2-t1
t3-=k
print(t3)

Solution (Python):
h1,m1,h2,m2,k= map(int,input().split())
wake = h1*60+m1
sleep = h2*60+m2
print(sleep-k-wake)

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())
h3 = k//60
m3 = k%60
print((h2-h3-h1)*60+m2-m3-m1)

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())

ans = (H2 - H1 - 1) * 60

tmp = 60 - M1 + M2

print(ans + tmp - K)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())

print((h2*60+m2-h1*60-m1-k))

Solution (Python):
H1, M1, H2, M2, K = input().split()

print((int(H2)-int(H1))*60+int(M2)-int(M1)-int(K))

Solution (Python):
LI = lambda: list(map(int, input().split()))

h1, m1, h2, m2, k = LI()
print(60*h2+m2-60*h1-m1-k)

Solution (Python):
h1, m1, h2, m2, K = (int(i) for i in input().split())  

t1 = h1 * 60 + m1
t2 = h2 * 60 + m2

print(max(0, t2 - K - t1))

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
print(h2 * 60 + m2 - h1 * 60 - m1 - k)

Solution (Python):

HMK = list(map(int, input().split()))




st = HMK[0] * 60 + HMK[1]
et = HMK[2] * 60 + HMK[3]

print(et - st - HMK[4])

Solution (Python):
def task(h1, m1, h2, m2, k):
    t1 = h1 * 60 + m1
    t2 = h2 * 60 + m2
    t = t2 - t1
    print(max(0, t - k))
    


h1, m1, h2, m2, k = map(int, input().split())
task(h1, m1, h2, m2, k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())

if h1 == h2:
    if k > (m2 - m1):
        print(0)
    else:
        print(m2-m1-k)
else:
    if k > (h2-h1)*60 + m2-m1:
        print(0)
    else:
        print((h2-h1)*60 + m2-m1-k)

Solution (Python):
H1,M1,H2,M2,K = map(int, input().split())

print((H2-H1)*60 + (M2-M1) - K)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    h1, m1, h2, m2, k = map(int, input().split())
    t = (h2 - h1) * 60 + (m2 - m1)
    print(max(0, t - k))


if __name__ == '__main__':
    resolve()

Solution (Python):
def solve(h1, m1, h2, m2, k):
    res = (h2 - h1) * 60 + (m2 - m1) - k
    return res


def main():
    h1, m1, h2, m2, k = map(int, input().split())
    res = solve(h1, m1, h2, m2, k)
    print(res)


def test():
    assert solve(10, 0, 15, 0, 30) == 270
    assert solve(10, 0, 12, 0, 120) == 0


if __name__ == "__main__":
    test()
    main()

Solution (Python):
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

H1, M1, H2, M2, K = rl()

t1 = H1*60+M1
t2 = H2*60+M2

print(max(t2-t1-K, 0))

Solution (Python):
H_s, M_s, H_e, M_e, K = map(int, input().split())

time = (H_e - H_s) * 60 + (M_e - M_s) - K
print(time)

Solution (Python):
h,m,H,M,k=map(int,input().split())
ha=H-h
ma=M-m
ans=ha*60+ma-k
print(ans)

Solution (Python):
h1,m1,h2,m2,k=list(map(int,input().split()))

s=60*h1+m1
t=60*h2+m2-k

print(t-s)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
hour = h2-h1
minute = m2 - m1
time = hour*60 + minute
ans = time - k
print(ans)

Solution (Python):
inf = 10 ** 15
mod = 10 ** 9 + 7
h1,m1,h2,m2,k = map(int, input().split())
ans = ((h2-h1)*60+(m2-m1))-k
print(ans)

Solution (Python):
A,B,C,D,K = map(int,input().split())

p=C-A
q=D-B

ren=p*60+q
if ren>=K:
  print(ren-K)
else:
  print(0)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
w=h2*60+m2-(h1*60+m1)-k
print(w)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())

long=h2*60+m2-(h1*60+m1)
print(long-k)

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())
diff = (H2-H1)*60+(M2-M1)-K
print(diff)

Solution (Python):
t1, m1, t2, m2, study = map(int, input().split())

startz = t1*60+m1
endz = t2*60+m2

res = endz - startz - study
if res < 0: res = 0
print(res)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
t1 = h1*60+m1
t2 = h2*60+m2
print(t2-t1-k)

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())
print(max(0,(h2 - h1)*60 + (m2 -m1) - k))

Solution (Python):
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]





H1, M1, H2, M2, K = list(map(int, input().split()))

t1 = H1*60 + M1
t2 = H2*60 + M2

t = t2-t1
ans = max(0, t-K)
print(ans)

Solution (Python):


def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))


h1,m1,h2,m2,k = input_multiple_number()

m = 0
m += (h2-h1)*60
m += (m2-m1)

print(m-k)

Solution (Python):
h1,m1,h2,m2,k = map(int, input().split())
x = 60*(h2-h1-1)+(m2-m1+60)
print(x-k)

Solution (Python):
h1, m1, h2,m2,k = map(int, input().strip().split())

print(h2*60+m2-(h1*60+m1)-k)

Solution (Python):
def main():
    h,m,H,M,K = list(map(int,input().split()))
    A = 60*H+M - (60*h+m)
    B = A - K
    print(B)
    
if __name__ == '__main__':
    main()

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    H1, M1, H2, M2, K = map(int, input().split())

    if H1 == H2:
        time = M2 - M1
    else:
        time = (60 - M1) + (H2 - H1 - 1) * 60 + M2

    ans = time - K
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
h,m,H,M,K=map(int,input().split())
print(60*H+M-60*h-m-K)

Solution (Python):
H1,M1,H2,M2,K = map(int,input().split())

t1 = H1*60+M1
t2 = H2*60+M2
dt = t2-t1

print(max(dt-K,0))

Solution (Python):
H1,M1,H2,M2,K = map(int,input().split())

st = H1 * 60 + M1
ed = H2 * 60 + M2
print(ed-st-K)

Solution (Python):

h1, m1, h2, m2, k = map(int, input().split())



t1 = 60*h1 + m1
t2 = 60*h2 + m2

print(t2-t1-k)

Solution (Python):
ho,mo,ht,mt,k=map(int,input().split())
m=0
if mt<mo:
  ht=ht-1
  m+=mt+60-mo
else:
  m+=mt-mo
m+=(ht-ho)*60
print(m-k)

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())
h = H2 - H1
m = M2 - M1
T = h * 60 + m
print(T-K)

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())
oki = h2*60+m2 - h1*60-m1
if(oki < 0):
    oki = 60*24 - oki

print(oki - k)

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())

print((h2-h1)*60+(m2-m1)-k)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
ans=(h2-h1)*60+(m2-m1)-k
print(ans)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
s1=h1*60+m1
s2=h2*60+m2
print(s2-k-s1)

Solution (Python):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]

def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]

def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

h1,m1,h2,m2,k = MI()
res = (h2-h1)*60
res += m2-m1
print(res-k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
print(max((h2*60+m2) - (h1*60+m1) - k, 0))

Solution (Python):
H1, M1, H2, M2, K = list(map(int, input().split()))

H1_m = H1 * 60
H2_m = H2 * 60

print((H2_m + M2) - (H1_m + M1) - K)

Solution (Python):

H, M, h, m, K = map(int, input().split())

print((h - H) * 60 + (m - M) - K)

Solution (Python):
h1, m1, h2, m2, k = map(int,input().split())
print(60*h2+m2-60*h1-m1-k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
print(h2*60 + m2 - h1*60 - m1 -k)

Solution (Python):
x = input().split()

h1 = int(x[0])
m1 = int(x[1])
h2 = int(x[2])
m2 = int(x[3])
k = int(x[4])

print((h2-h1)*60+m2-m1-k)

Solution (Python):
H1,M1,H2,M2,K = map(int, input().split())

print((H2-H1)*60+M2-M1-K)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    h,m,hh,mm,k=map(int,input().split())
    val=(hh-1-h)*60+(mm+60-m)
    print(val-k)
    
resolve()

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
H1 = h1 * 60 + m1
H2 = h2 * 60 + m2 - k
print(H2 - H1)

Solution (Python):
h1,m1,h2,m2,k = map(int, input().split(" "))
print((h2-h1)*60+(m2-m1)-k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
min = (h2 - h1) * 60 + (m2 - m1)

print(min - k)

Solution (Python):
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter

from functools import lru_cache

sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


data = inpl()
begin = data[0] * 60 + data[1]
end = data[2] * 60 + data[3]
print(max(0, end - begin - data[-1]))

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())
ans = (H2*60 + M2) - (H1*60 + M1) - K
print(ans)

Solution (Python):
A,B,C,D,E = list(map(int , input().split()))
ans1 = (C*60 + D) - (A*60 +B) - E
if ans1 > 0:
    print(ans1)
else:
    print(0)

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())
print(60*H2+M2 - 60*H1 - M1 -K)

Solution (Python):
a, b, c, d, k = map(int, input().split())
x = a * 60 + b
y = c * 60 + d

print((y - x) % (24 * 60) - k)

Solution (Python):

import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62



def solve(H: "List[int]", M: "List[int]", K: int):
    start = H[0] * 60 + M[0]
    end = H[1] * 60 + M[1]
    print(end - start - K)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = [int()] * (2)  
    M = [int()] * (2)  
    for i in range(2):
        H[i] = int(next(tokens))
        M[i] = int(next(tokens))
    K = int(next(tokens))  
    solve(H, M, K)

if __name__ == '__main__':
    main()

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
t=(h2-h1)*60+(m2-m1)
print(t-k)

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split(" "))
print((H2 * 60 + M2) - (H1 * 60 + M1) - K)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
print(-h1*60-m1+h2*60+m2-k)

Solution (Python):
a = list(map(int,input().split()))
print(a[2]*60+a[3]-a[0]*60-a[1]-a[4])

Solution (Python):
h1, m1,h2,m2,k = map(int, input().split())

hm=(h2*60+m2)-(h1*60+m1)-k
print (hm)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
zikan = 60*(h2-h1) + m2-m1
zikan -= k
if zikan>= 0:
    print(zikan)
else:
    print(0)

Solution (Python):
inputs = input().split(' ')
h1 = int(inputs[0])
m1 = int(inputs[1])
h2 = int(inputs[2])
m2 = int(inputs[3])
k = int(inputs[4])

t1 = h1 * 60 + m1
t2 = h2 * 60 + m2
print(t2 - t1 - k)

Solution (Python):
h1, m1, h2, m2, k = (int(x) for x in input().split())
ans = (h2-h1) * 60 + (m2-m1) - k
print(ans)

Solution (Python):
H1,M1,H2,M2,K=map(int,input().split())

A1=H1*60+M1
A2=H2*60+M2
ans=A2-A1-K
print(ans)

Solution (Python):




h1, m1, h2, m2, k = map(int,input().split())


hm1 = h1 * 60 + m1
hm2 = h2 * 60 + m2
ans = hm2 - hm1 - k


print(ans)

Solution (Python):
H1,M1,H2,M2,K = map(int,input().split())
m1 = H1*60 + M1
m2 = H2*60 + M2
l = m2-K-m1
print(max(0,l))

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())

print((h2 - h1)*60 + (m2 - m1) - k)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

h1, m1, h2, m2, k = MAP()
print(h2 * 60 + m2 - h1 * 60 - m1 - k)

Solution (Python):
A,B,C,D,E = map(int,input().split())

sa = (C-A) * 60 + D-B

print (sa - E)

Solution (Python):
"""    Arnab Chanda    """

from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
import heapq

int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline().split()
multi_int_input =lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input=lambda : list(map(int,stdin.readline().split()))
string_list_input=lambda: list(string_input())
MOD = pow(10,9)+7


h1, m1, h2, m2, k = multi_int_input()

start = (h2 - h1)*60 + m2-m1

print(start - k)

Solution (Python):
hako=list(map(int,input().split()))
kaisi=hako[0]*60+hako[1]
neru=hako[2]*60+hako[3]
print(neru-kaisi-hako[-1])

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())
t = 60*(h2-h1)+(m2-m1)
print(t-k)

Solution (Python):
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b,c,d,k = map(int,stdin.readline().rstrip().split())

iti = c*60+d-(a*60+b)
print(iti-k)

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())
s = H1 * 60 + M1
e = H2 * 60 + M2
print(e - s - K)

Solution (Python):
a,b,c,d,e=map(int,input().split())
a=a*60+b
c=c*60+d
print(c-a-e)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
print((h2-h1)*60+(m2-m1-k))

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())

print((H2 * 60 + M2) - (H1 * 60 + M1) - K)

Solution (Python):

import sys


def solve(H: "List[int]", M: "List[int]", K: int):
    okiru=H[0]*60+M[0]
    neru=H[1]*60+M[1]
    print(neru-okiru-K)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = [int()] * (2)  
    M = [int()] * (2)  
    for i in range(2):
        H[i] = int(next(tokens))
        M[i] = int(next(tokens))
    K = int(next(tokens))  
    solve(H, M, K)

if __name__ == '__main__':
    main()

Solution (Python):
H,M,h,m,K=map(int,input().split())
print((h-H)*60+m-M-K)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
s=(h2-h1)*60
t=m2-m1
print(s+t-k)

Solution (Python):

import sys


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


def solve():
    h1, m1, h2, m2, k = IL(int)
    all_time = (h2 * 60 + m2) - (h1 * 60 + m1)
    print(all_time - k)


solve()

Solution (Python):
h,m,H,M,K = [int(i) for i in input().split()]
T = 60*(H-h) + (M-m) - K
print(T)

Solution (Python):

import collections


def solve(h1, m1, h2, m2, k):
    mins1 = h1*60 + m1
    mins2 = h2*60 + m2

    return mins2-mins1-k


[h1, m1, h2, m2, k] = list(map(int, input().strip().split()))

print(solve(h1, m1, h2, m2, k))

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h1, m1, h2, m2, k = map(int, input().split())

print((h2 - h1)* 60 + (m2 - m1) - k)

Solution (Python):
[H1, M1, H2, M2, K] = [int(n) for n in input().split()]
D1 = H1 * 60 + M1
D2 = H2 * 60 + M2

print(D2 - K - D1)

Solution (Python):
h,m,hh,mm,k = map(int,input().split())

wakeup = (hh-h)*60 + mm - m

print(wakeup-k)

Solution (Python):
a,b,c,d,k=map(int,input().split())
use=a*60+b 
want=c*60+d 
print(want-use-k)

Solution (Python):
h1, m1, h2, m2, k = list(map(int, input().split()))

t1 = h1*60 + m1
t2 = h2*60 + m2

print(t2 - t1 - k)

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())

t1 = h1*60+m1
t2 = h2*60+m2
print(t2-t1-k)

Solution (Python):
a, b, c, d, k = map(int, input().split())
print((c-a)*60+(d-b)-k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())

print(h2 * 60 + m2 - (h1 * 60 + m1) - k)

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())
a = h1*60 + m1
b = h2*60 + m2
print(b-a-k)

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())

a = 60*h1+m1
b = 60*h2+m2
print(b-a-k)

Solution (Python):
h, m, H, M, k = map(int, input().split())
t = (H - h)*60 + M-m
print(t-k)

Solution (Python):
a,b,c,d,e=map(int,input().split())
f=(c-a)*60+d-b-e
print(f)

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

INF = float("inf")











H1,M1,H2,M2,K = map(int,input().split())
num = 0
num += 60 - M1
H1 += 1
num += M2
num += (H2-H1)*60
print(num-K)

Solution (Python):
h1, m1, h2, m2, k = map(int ,input().split())

ss = m1 + h1 * 60
gg = m2 + h2 * 60

print(gg-ss-k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
a1 = h1 * 60 + m1
a2 = h2 * 60 + m2
print((a2 - a1) - k)

Solution (Python):
h, m, h2, m2, k = map(int, input().split())


m1 = h * 60 + m
m2 = h2 * 60 + m2

if(m2 - m1):
    time = m2 - m1
else:
    time = 1440 - m1 + m2

ans = max(time - k, 0)
print(ans)

Solution (Python):
a,b,c,d,e=map(int,input().split())
x=60*a+b
y=60*c+d
print((y-x)-e)

Solution (Python):
from sys import stdin
input = stdin.readline

t = list(map(int, input().split()))

ans = (t[2] - t[0]) * 60 + (t[3] - t[1]) - t[4]

print(max(0, ans))

Solution (Python):
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

h1,m1,h2,m2,k = mi()

print(max(0,(h2*60+m2)-(h1*60+m1)-k))

Solution (Python):
H_1, M_1, H_2, M_2, K = map(int, input().split())

print((H_2 - H_1)*60 + (M_2 - M_1) - K)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())

hm1 = h1 * 60 + m1
hm2 = h2 * 60 + m2

print(hm2 - hm1 - k)

Solution (Python):
def main():
    H1,M1,H2,M2,K  = map(int,(input().split()))
    time1=H1*60+M1
    time2=H2*60+M2
    print(time2-time1-K)

if __name__ == '__main__':
    main()

Solution (Python):
H1, M1, H2, M2, K = list(map(int, input().split()))
print(H2*60 + M2 - K - H1*60 - M1)

Solution (Python):
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")



def main():
    H1, M1, H2, M2, K = map(int, input().split())
    a = M1 + H1 * 60
    b = M2 + H2 * 60
    if b-a < K:
        print(0)
    else:
        print(b-a-K)
    


if __name__ == '__main__':
    main()

Solution (Python):
h, m, hh, mm, k = map(int, input().split())
print(hh*60 + mm - h*60 - m - k)

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())
H1 += 1
M1 = 60 - M1

print(max(0, M1 + M2 + (H2 - H1) * 60 - K))

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
	return list(map(int,input().split()))
def m(): 
	return map(int,input().split())
def onem(): 
	return int(input())
def s(x): 
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): 
	return " ".join(map(str,x))
def max2(x): 
	return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

h1,m1,h2,m2,k = m()

po = h2-h1
poo = m2-m1

if poo < 0:
	po -= 1
	poo += 60


print(po*60+poo-k)

Solution (Python):
h1, m1, h2, m2, k = list(map(int, input().split()))

h = h2 - h1
m = m2 - m1

print(h * 60 + m - k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
ans = h2*60 + m2 - h1*60 - m1 - k
print(ans)

Solution (Python):
def main():
    h1, m1, h2, m2, k = [int(x) for x in input().split()]
    t1 = 60 * h1 + m1
    t2 = 60 * h2 + m2
    ans = t2 - k - t1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())
delt = 60*(h2-h1) + (m2-m1)
print(delt-k)

Solution (Python):
h1,m1,h2,m2,k = map(int, input().split())

ans = (h2*60+m2)-(h1*60+m1)-k
print(ans)

Solution (Python):
Hs, Ms, He, Me, K = [int(x) for x in input().split()]
M = He * 60 + Me - (Hs * 60 + Ms) - K
print(M)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
rest = max((h2 - h1) * 60 + (m2 - m1) - k, 0)
print(rest)

Solution (Python):
h1,m1,h2,m2,k=[int(_) for _ in input().split()]

t1=60*h1+m1
t2=60*h2+m2

print(t2-t1-k)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
diff=(h2*60 + m2) - (h1*60 + m1)
print(diff-k)

Solution (Python):
a, b, c, d, k = map(int, input().split())

time = (c*60+d)-(a*60+b)-k
print(time)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7



H1, M1, H2, M2, K = MAP()

print(max(0, 60*H2+M2-60*H1-M1-K))

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    H1,M1,H2,M2,K = map(int, input().split())
    if M2>=M1:
        print((H2-H1)*60+M2-M1-K)
    else:
        print((H2-H1-1)*60+60+M2-M1-K)

if __name__ == '__main__':
    main()

Solution (Python):

H1, M1, H2, M2, K = map(int,(input().split()))

oki = H1 * 60 + M1
ne = H2 * 60 + M2


print(ne - oki - K)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())

print((h2 - h1) * 60 + m2 - m1 - k)

Solution (Python):
H,M,h,m,K=map(int,input().split())

tot=h*60+m-H*60-M-K
print(tot)

Solution (Python):

from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce


MOD = 1000000007

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def combination(m,n):
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def main():
    a, b, c, d, e = [int(x) for x in stdin.readline().rstrip().split()]
    start = a*60 + b
    end = c*60 + d
    print(end - start - e)

main()

Solution (Python):
h,m,h2,m2,k=map(int,input().split())
ans=(h2-h)*60
ans+=m2-m-k
print(ans)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split(" "))
print(h2*60+m2-k-60*h1-m1)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
m1=h1*60+m1
m2=h2*60+m2
print(m2-m1-k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
print(h2 * 60 + m2 - (h1 * 60 + m1) - k)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
t=(h2-h1)*60+(m2-m1)
print(max(t-k,0))

Solution (Python):
h,m,H,M,k = map(int,input().split())
start = 60*h+m
end = 60*H+M
ans = end-start-k
if ans<0:
    ans = 0
print(ans)

Solution (Python):

H1, M1, H2, M2, K = list(map(int, input().split()))

T1 = H1 * 60 + M1
T2 = H2 * 60 + M2
T2_minus_K = T2 - K

print(max(T2_minus_K - T1, 0))

Solution (Python):
h1,m1,h2,m2,k = map(int,input().split())
h = h2-h1
m = m2-m1
print(h*60+m-k)

Solution (Python):
A,B,C,D,E = map(int,input().split())

g = A*60+B
s = C*60+D

s -= E
ans = s-g
print(ans)

Solution (Python):
sh, sm, eh, em, k = map(int, input().split())
s = sh * 60 + sm
e = eh * 60 + em
e -= k
print(e-s)

Solution (Python):
def main():
    H1, M1, H2, M2, K = map(int, input().split())

    ans = H2*60 + M2 - H1*60 - M1 - K

    print(max([ans, 0]))


if __name__ == "__main__":
    main()

Solution (Python):
H1, M1, H2, M2, K=map(int,input().split())
print(60*H2+M2-60*H1-M1-K)

Solution (Python):
h1,m1,h2,m2,k=map(int,input().split())
print(((h2*60+m2)-(h1*60+m1))-k)

Solution (Python):
h_1, m_1, h_2, m_2, k = map(int, input().split())
time = h_1 * 60 + m_1
print(h_2 * 60 + m_2 - time - k)

Solution (Python):
H1,M1,H2,M2,K = map(int,input().split())
print((H2-H1)*60+(M2-M1)-K)

Solution (Python):
import math
h,m,h2,m2,k = map(int,input().split())
all = h2*60+m2 - (h*60+m)
print(all - k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
a = (h2-h1)*60+(m2-m1)-k
print(a)

Solution (Python):

from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

h1,m1,h2,m2,k = inm()
print(h2*60+m2-(h1*60+m1)-k)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
time = (h2 - h1) * 60 + (m2 - m1)
print(str(time - k))

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())

ans = (h2 * 60 + m2) - (h1 * 60 + m1) - k
print(ans)

Solution (Python):
H1,M1,H2,M2,K=list(map(int, input().split()))

print((H2-H1)*60+M2-M1-K)

Solution (Python):
h1, m1, h2, m2, k = map(int,input().split())

s = 60*h1 + m1
f = 60*h2 + m2

print(f-s-k)

Solution (Python):
Hs,Ms,He,Me,K = map(int,input().split())
print(((He*60 + Me) - (Hs*60 + Ms)) - K) if (((He*60 + Me) - (Hs*60 + Ms)) - K) > 0 else print(0)

Solution (Python):
list = list(map(int,input().split()))
print((list[2]-list[0])*60+(list[3]-list[1])-list[4])

Solution (Python):



h1,m1,h2,m2,k=map(int,input().split())



t1 = 60 * h1 + m1
t2 = 60 * h2 + m2

ans = (t2 - t1) - k
print(ans)

Solution (Python):
h1, m1, h2, m2, k = map(int, input().split())
print(max(h2 * 60 + m2 - h1 * 60 - m1 - k, 0))

Solution (Python):
h, m, h2, m2, k = map(int, input().split())

i = h2 * 60 + m2 - (h * 60 + m)

print(i-k)

Solution (Python):
h1,m1,h2,m2,k=map(int, input().split())
s=h1*60+m1
e=h2*60+m2
print(max(e-s-k,0))

Solution (Python):
a,b,c,d,e=map(int,input().split())
A=a*60+b
B=c*60+d
print(max(0,B-A-e))

Solution (Python):
H1, M1, H2, M2, K = map(int, input().split())
print(max(0,H2*60+M2-(H1*60+M1)-K))

Solution (Python):
h_1, m_1, h_2, m_2, k = map(int, input().split())
m_1_1 = h_1 * 60 + m_1
m_2_1 = h_2 * 60 + m_2
m = m_2_1 - m_1_1 - k
print(m)