#include<bits/stdc++.h>
using namespace std;
int s,v;
int main(){
cin>>s>>v;
if(s%v!=0){
int ans=s/v;
int temp=ans/60;
ans%=60;
if(temp<8){
int h=7,m=60;
h-=temp;
m-=ans;
if(m-10<10)cout<<"0"<<h<<":0"<<m-11;
else cout<<"0"<<h<<":"<<m-11;
}else{
int h=31,m=60;
h-=temp;
m-=ans;
if(h<10)cout<<"0"<<h;
else cout<<h;
cout<<":";
if(m-10<10)cout<<"0"<<m-10-11;
else cout<<m-11;
}
}else{
int ans=s/v;
int temp=ans/60;
ans%=60;
if(temp<8){
int h=7,m=60;
h-=temp;
m-=ans;
if(m-10<10)cout<<"0"<<h<<":0"<<m-10;
else cout<<"0"<<h<<":"<<m-10;
}else{
int h=31,m=60;
h-=temp;
m-=ans;
if(h<10)cout<<"0"<<h;
else cout<<h;
cout<<":";
if(m-10<10)cout<<"0"<<m-10-10;
else cout<<m-10;
}
}
return 0;
}