#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int s = 0, v = 0,z;
cin >> s >> v;
if (s / v == 0) z = s / v;
else z = s / v + 1;
int rec1 = (z + 10) / 60;
int rec2 = (z + 10) % 60;
if (7 - rec1 >= 0)
{
if (60 - rec2 >= 10)
printf("0%d:%d", 7 - rec1, 60 - rec2);
else
printf("0%d:0%d", 7 - rec1, 60 - rec2);
}
else
{
if (60 - rec2 >= 10)
printf("%d:%d", 31 - rec1, 60 - rec2);
else
printf("%d:0%d", 31 - rec1, 60 - rec2);
}
return 0;
}