#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

void output(int h, int m){
    if(h % 24 < 10 && m < 10){
        cout << "0" << h % 24 << ":0" << m << endl;
    }else if(h % 24 < 10){
        cout << "0" << h % 24 << ":" << m << endl;
    }else if(m < 10){
        cout << h % 24 << ":0" << m << endl;
    }else{
        cout << h % 24 << ":" << m << endl;
    }
}

int main(){
    int a, b;
    string S;
    cin >> a >> b >> S;
    a += 24 - 9;
    if(S[3] == '+'){
        double time_difference = stod(S.substr(4, S.size()));
        output(int(a * 60 + b + time_difference * 60) / 60, int(a * 60 + b + time_difference * 60) % 60);
    }else{
        double time_difference = stod(S.substr(4, S.size()));
        output(int(a * 60 + b - time_difference * 60 + 24 * 60) / 60, int(a * 60 + b - time_difference * 60 + 24 * 60) % 60);
    }
}