#include <stdio.h>
int main(){
int s,v,hour,h2,min1,min2,time;
scanf("%d%d",&s,&v);
if(s%v==0) time=s/v+10;
else time=s/v+11;
if(time<=480){
if(time%60==0) hour=time/60;
else hour=time/60+1;
min1=time%60;
min2=60-min1;
h2=8-hour;
}
else{
if(time%60==0) hour=time/60;
else hour=time/60+1;
min1=time%60;
min2=60-min1;
h2=32-hour;
}
if(min2<10) printf("%2d:0%d",h2,min2);
else
printf("%2d:%2d",h2,min2);
return 0;
}