#include "bits/stdc++.h" using namespace std; typedef long long int ll; typedef pair pi; typedef pair, ll > pii; vector vec; vector vec2; ll MOD = 1000000007; ll INF = 1145141919454519; //謎の誤差が発生したのでstod使うのやめた int main() { ll a, b; cin >> a >> b; ll minute = a * 60 + b; //cout << minute << endl; string s; cin >> s; //double t = stod(s.substr(3,s.length()-3)); //double sabun = (t - 9) * 60; string st = s.substr(3,s.length()-3); ll tt = (st[1]-'0') * 60; if(st.length() == 4) tt += (st[3]-'0') * 6; if(st[0] == '-') tt *= -1; minute += tt - 9 * 60; if(minute < 0){ minute += 24 * 60; } if(minute >= 24 * 60){ minute -= 24 * 60; } cout << setw(2) << setfill('0') << minute / 60 << ":" ; cout << setw(2) << setfill('0') << minute % 60 << endl; }