#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int main() {
int s = 0, v = 0,t = 0;
int hh = 0, mm = 0;
cin >> s >> v;
t = s / v;
if (s % v != 0)
t++;
hh = t / 60;
mm = t % 60;
if (hh >= 24)
{
hh = 24;
mm = 0;
}
if (hh >= 0 && hh <= 7 && mm <= 50)
printf("%02d:%02d\n", 7 - hh, 50 - mm);
else if (hh > 7 && mm <= 50)
printf("%02d:%02d\n", 24 + 7 - hh, 50 - mm);
else if (hh >= 7 && mm >= 50)
printf("%02d:%02d\n", 24 + 7 - hh - 1, 60 + 50 - mm);
system("pause");
return 0;
}