nord vpnnord vpn
Ad

Avtobusi olimpiada

mail@pastecode.io avatar
unknown
plain_text
a month ago
449 B
2
Indexable
Never
h = int(input())
m = int(input())
a = int(input())
b = int(input())

f1 = []
f2 = []

HS = 480
HE = 1320

hm = h * 60 + m
if 480 < hm < 1320:
    for i in range(HS, HE + 1, a):
        if not((i-hm) < 0):
            f1.append(i-hm)
    i = 0
    for i in range(HS, HE + 1, b):
        if not((i-hm) < 0):
            f2.append(i-hm)
    i = 0
    try:
        print(min(min(f1), min(f2)))
    except ValueError:
        print(-1)
else:
    print(0)

nord vpnnord vpn
Ad