#include using namespace std; typedef long long ll; #define F first #define S second #define pii pair #define eb emplace_back #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < n; ++i) #define rep3(i, l, n) for (int i = l; i < n; ++i) #define chmax(a, b) a = max(a, b) #define chmin(a, b) a = min(a, b) #define out(a) cout << a << endl #define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl #define SZ(v) (int)v.size() #define inf (int)(1e9+7) int main() { int a, b; cin >> a >> b; string s; cin >> s; double tmp = stod(s.substr(3, SZ(s) - 3)); char op = (tmp - 9 > 0 ? '+' : '-'); tmp = abs(9 - tmp); int n1 = tmp; tmp -= n1; tmp *= 10; int n2 = tmp; //out(n1 << " " << n2 << " " << op); if (op == '-') { int ti = 60 * n1 + 6 * n2; while (ti--) { if (a == 0 && b == 0) a = 24; if (b == 0) { a--; b = 59; continue; } b--; } } else { b += 6 * n2; if (b >= 60) {a++; b -= 60; } (a += n1) %= 24; } out(setw(2) << setfill('0') << a << ":" << setw(2) << setfill('0') << b); }