#include<stdio.h>
int main()
{
int s,v;
scanf("%d%d",&s,&v);
int t;
if(s%v==0)
t=s/v+10;
else {
t=s/v+11;
}
int h,m;
if(t%60==0){
m=0;
if(t/60<=8)
h=8-t/60;
else
h=32-t/60;
}
else{
if(t<=480){
h=7-t/60;
m=60-t%60;
}
else
h=23-(t-480)/60;
m=60-(t-480)%60;
}
int h1,h2;
int m1,m2;
h1=h/10;
h2=h-10*h1;
m1=m/10;
m2=m-10*m1;
printf("%d%d:%d%d",h1,h2,m1,m2);
return 0;
}