// yukicoder: No.651 E869120 and Driving // 2019.4.23 bal4u #include #include #include int main() { int a, b, h, m, w, tm; char s[10]; scanf("%d%d%s", &a, &b, s); tm = a*60+b; w = strlen(s); m = 0; if (w >= 3 && s[w-2] == '.') m = 6*(s[w-1] & 0xf); h = atoi(s+3); if (h >= 9) tm += (h-9)*60+m; else if (s[3] == '-') tm -= (9-h)*60+m; else tm -= (9-h)*60 - m; if (tm < 0) tm += 1440; else if (tm >= 1440) tm -= 1440; printf("%02d:%02d\n", tm/60, tm%60); return 0; }