#include using namespace std; int a,b,c;string S,T; int main(){ cin>>a>>b>>S;T=S.substr(4,S.size()-4); if(T.size()<=2){c=stoi(T)*60;} else{c=stoi(T.substr(0,T.size()-2))*60;c+=(T[T.size()-1]-'0')*6;} if(S[3]=='-')c*=-1;c-=540;c*=-1; int d=a*60+b-c;if(d<0)d+=1440;else if(d>1440)d-=1440; printf("%02d:%02d\n",d/60,d%60); return 0; }