#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int s, v, t1, t2, h, m;
cin >> s >> v;
if(s%v==0)
{
t1 = 10 + s/v;
}
else
{
t1 = 11 + s/v;
}
t2 = 480 - t1;
h = t2 / 60;
m = abs(t2) - abs(h) * 60;
if(h < 0)
{
h = 24 + h;
}
if(h<10)
{
if(m<10)
{
cout << 0 << h << ":" << 0 << m;
return 0;
}
else
{
cout << 0 << h << ":" << m;
return 0;
}
}
else
{
if(m<10)
{
cout << h << ":" << 0 << m;
return 0;
}
else
{
cout << h << ":" << m;
return 0;
}
}