#include #include #include #include #include #include #include using namespace std; int main(){ int a, b,c = -9999; string s; cin >> a >> b >> s; int seisuu = -9999, syousuu = -9999; string left, right; s = s.substr(3); if (s.find('.') == string::npos) { seisuu = stoi(s) - 9; a += seisuu; if (a < 0) a = 24+a; else a = a%24; left = (to_string(a).length() == 1)? "0" + to_string(a): to_string(a); right = (to_string(b).length() == 1)? "0" + to_string(b): to_string(b); cout << left << ":" << right << endl; return 0; } int pos = s.find('.'); seisuu = stoi(s.substr(0, pos)) - 9; syousuu = stoi(s.substr(pos+1)) * 6; if (seisuu < 0) { b = b - syousuu; if (b < 0) { b = 60+b; a -= 1; } else { a += b/60; b = b%60; } if (a < 0) a = 24+a; else a = a%24; left = (to_string(a).length() == 1)? "0" + to_string(a): to_string(a); right = (to_string(b).length() == 1)? "0" + to_string(b): to_string(b); cout << left << ":" << right << endl; return 0; } b = b + syousuu; a += b/60; b = b%60; a += seisuu; if (a < 0) a = 24+a; else a = a%24; left = (to_string(a).length() == 1)? "0" + to_string(a): to_string(a); right = (to_string(b).length() == 1)? "0" + to_string(b): to_string(b); cout << left << ":" << right << endl; }