#include <stdio.h>
int main()
{
int s,v,t,t2;
scanf("%d %d",&s,&v);
if(s%v==0){
if(s/v<=470){
t=470-s/v;
if(t>=60){
if(t%60<10){
printf("0%d:0%d",t/60,t%60);
}else{
printf("0%d:%d",t/60,t%60);
}
}else{
if(t%60<10){
printf("00:0%d",t%60);
}else{
printf("00:%d",t%60);
}
}
}else{
t2=s/v+10-480;
if(t2>=60){
if(t2%60>50){
printf("%d:0%d",12-t2/60,60-t2%60);
}else{
printf("%d:%d",12-t2/60,60-t2%60);
}
}else{
if(t2%60>50){
printf("23:0%d",60-t2%60);
}else{
printf("23:%d",60-t2%60);
}
}
}
}else{
if(s/v<=470){
t=470-s/v;
if(t>=60){
if(t%60<10){
printf("0%d:0%d",t/60,t%60-1);
}else{
printf("0%d:%d",t/60,t%60-1);
}
}else{
if(t%60<10){
printf("00:0%d",t%60-1);
}else{
printf("00:%d",t%60-1);
}
}
}else{
t2=s/v+10-480;
if(t2>=60){
if(t2%60>50){
printf("%d:0%d",12-t2/60,60-t2%60-1);
}else{
printf("%d:%d",12-t2/60,60-t2%60-1);
}
}else{
if(t2%60>50){
printf("23:0%d",60-t2%60-1);
}else{
printf("23:%d",60-t2%60-1);
}
}
}
}
return 0;
}