#include using namespace std; using ll = long long; using ul = unsigned long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int a, b; string s; cin >> a >> b >> s; int t1 = a * 60 + b; auto pos = s.find('.'); int h, m; if (pos != string::npos) { h = stoi(s.substr(4, pos - 3)); m = stoi(s.substr(pos + 1)) * 6; } else { h = stoi(s.substr(4)); m = 0; } int t2; string op = s.substr(3, 1); if (op == "+") t2 = 540 - (h * 60 + m); else t2 = (9 + h) * 60 + m; int t = t1 - t2; if (t < 0) t += 24 * 60; int hh = (t / 60 + m / 60) % 24, mm = t % 60; string res; res = (hh < 10 ? "0" : "") + to_string(hh) + ":" + (mm < 10 ? "0" : "") + to_string(mm); cout << res << "\n"; return 0; }