#include<stdio.h>
int main() {
int s, v;
int t;
int t_hour, t_minutes;
scanf("%d%d", &s, &v);
if (s / v == 0) {
t = s / v + 10;
}
else {
t = s / v + 10 + 1;
}
t = t % (24 * 60);
if (t > 8 * 60) {
t = (24 + 8) * 60 - t;
t_hour = t / 60;
t_minutes = t - t_hour * 60;
if ((t_hour < 10) && (t_hour != 0)) {
printf("0%d:", t_hour);
}
else if (t_hour == 0) {
printf("00:");
}
else {
printf("%d:", t_hour);
}
if ((t_minutes < 10) && (t_minutes != 0)) {
printf("0%d", t_minutes);
}
else if (t_minutes == 0) {
printf("00");
}
else {
printf("%d", t_minutes);
}
}
else if (t == 8 * 60) {
printf("00:00");
}
else {
t = 8 * 60 - t;
t_hour = t / 60;
t_minutes = t - t_hour * 60;
if ((t_minutes < 10) && (t_minutes != 0)) {
printf("0%d:0%d", t_hour, t_minutes);
}
else if (t_minutes == 0) {
printf("0%d:00", t_hour);
}
else {
printf("0%d:%d", t_hour, t_minutes);
}
}
return 0;
}