# Add time

 

def hms(s):

    dd = dict(zip([1, 60, 360], [float(i) for i in s.split(':')]))

    return sum([f/v for v, f in dd.items()])

 

def main():

    origTime = raw_input("Enter clock time (hh:mm): ")

    hrsAdd = raw_input("Enter hours to add (hh:mm): ")

    return hms(origTime) + hms(hrsAdd)

 

print main()