#include using namespace std; int main() { int a, b; cin>>a>>b; string s; cin>>s; double t = 0; int i = 4; while (i < s.length()) { if (s[i] == '.') { t += 0.1 * (s[i+1] - '0'); break; } t = 10 * t + s[i] - '0'; ++i; } if (s[3] == '-') { t *= -1; } int d = (int)((t - 9) * 60 + 60 * 24) % (60 * 24); int x = (a + d / 60) % 24; int y = b + d % 60; if (y >= 60) { ++x; y %= 60; } if (x == 24) { x = 0; } printf("%02d:%02d\n", x, y); }