#include<bits/stdc++.h>
using namespace std;
int main(){
int h,m,s,t;
cin>>h>>m>>s>>t;
m=h*60+m+90*t;
h=(m+2160)%2160/60;
m=(m+2160)%2160%60;
cout<<h<<":"<<setw(2)<<setfill('0')<<m<<":"<<setw(2)<<setfill('0')<<s<<'\n';
//setw(2)設定下一個輸出的欄位寬度為 2 個字元。
//setfill('0')再次確保沒滿 2 位數時會補 0
}