#include <bits/stdc++.h>
using namespace std;
int main()
{
int s,t,h;
cin>>s>>t;
int n=480+24*60;
if(s%t!=0)
{
h=s/t+11;
}
else
h=s/t+10;
if(h<=480)
n=n-24*60-h;
int HH,MM;
MM=n%60;
HH=n/60;
if(HH<10)
{
cout<<"0"<<HH<<":";
}
else
{
cout<<HH<<":";
}
if(MM<10)
{
cout<<"0"<<MM;
}
else
cout<<MM;
return 0;
}