a, b, c, d = map(int, input().split()) delta = (a-1)*d num = 60 * b + c num += delta num %= (60*24) o = num/600 num%=600 p = num/60 num%=60 q = num/10 num%=10 r = num print(o,end='') print(p) print(q,end='') print(r)