#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for(int i = (n) - 1; (i) >= 0; --i) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD LL(1e9 + 7) #define INF 1000000 using namespace std; typedef long long LL; typedef vector VI; typedef pair PI; int main() { int a, b; string s; cin >> a >> b >> s; double t = stoi(s.substr(3, s.length() - 3)); if (s[s.size() - 2] == '.') if(t > 0) t += (s[s.length() - 1] - '0') * 0.1; else t -= (s[s.length() - 1] - '0') * 0.1; t -= 9; b += t * 60; while (b >= 60) { a++; b -= 60; } while (b < 0) { a--; b += 60; } if (a >= 24) a -= 24; if (a < 0) a += 24; string h = to_string(a); string m = to_string(b); if (h.length() == 1) h.insert(0, "0"); if (m.length() == 1) m.insert(0, "0"); cout << h << ":" << m << endl; return 0; }