#include #include #include #include #include #include #include using namespace std; int main(){ int a, b,c = -9999; string s; cin >> a >> b >> s; int ina = a; int inb = b; 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) { a += seisuu; b = (b + syousuu)%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; } a = a + seisuu; cout << a << endl; b = b + syousuu; a += b/60; cout << a << endl; 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; }