#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
	 int M,S,T;
	 cin>>M>>S>>T;
	 int s(M/10*60),t(M/10),mp(M%10);
	 while(t>T)
	 {
	 	t--;
	 	s-=60;
	 }
	 while(s<S&&t<T)
	 {
	 	int temp=ceil((10-mp)/(4.0));
	 	if(temp>=T-t||(temp+1)*17>=S-s)
	 	{
		 	t++;
			s+=17;
	 	}
	 	else
	 	{
	 		t+=temp+1;
	 		s+=60;
	 		mp+=temp*4;
	 		mp%=10;
	 	}
	 }
	 if(s>=S)
	 	cout<<"Yes"<<endl<<t<<endl;
	 if(s<S)
	 	cout<<"No"<<endl<<s<<endl;
	 return 0;
}
/**************************************************************
	Problem: 2270
	User: admin
	Language: C++
	Result: Accepted
	Time:48 ms
	Memory:2072 kb
****************************************************************/