for(;l=(t=readline(s=c='')).split(/\D/);print(t+s.replace(/\b9/g,'')))for(i=3;i--;s='=::'[i]+(900-v%(i?60:24))+s,c=v/60|0)v=-l[i]-l[i+3]+c