#include using namespace std; typedef long long ll; #define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++) #define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++) #define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--) #define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--) #define all(x) (x).begin(), (x).end() #define sz(x) ((ll)(x).size()) #define len(x) ((ll)(x).length()) int main() { cin.tie(0); ios::sync_with_stdio(false); // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); ll a, b; string s; cin >> a >> b >> s; double time = a * 60 + b; double d = 0; double k = 1; rrep(i, len(s)) { if (s[i] == '+') break; if (s[i] == '-') { d *= -1; break; } if (s[i] == '.') { ll x = len(s) - i - 1; ll div = 1; rep(j, x) div *= 10; k = 0.1; d /= div; } else { d += k * (s[i] - '0'); } k *= 10; } ll nt = (d - 9) * 60; ll ans = ((ll)time + 24 * 60 + nt) % (24 * 60); printf("%02lld:%02lld\n", ans / 60, ans % 60); return 0; }