#include<stdio.h>
int main()
{
int M, S, T;
int a, b, t, s, c;
freopen("escape.in","r",stdin);
freopen("escape.out","w",stdout);
scanf("%d %d %d", &M, &S, &T);
a = M / 10;
b = M % 10;
if (b < 2)
s = S - a * 60;
else if (b > 1 && b < 6)
{
s = S - (a + 1) * 60;
c = a + 3;
}
else if (b > 5 && b < 8)
{
s = S - (a + 1) * 60;
c = a + 2;
}
else
{
s = S - (a + 2) * 60;
c = a + 5;
}
if (s % 17 != 0)
t = s / 17 + 1;
else
t = s / 17;
if (c + t <= T&&t>=0)
printf("Yes\n%d", c + t);
else
{
if (T <= a)
s = t * 60;
else if (T > a&& t < c)
{
if (c != a + 5)
s = a * 60 + (T - a) * 17;
else
{
if (T - a < 2)
s = a * 60 + (T - a) * 17;
else
s = (a + 1) * 60 + (T - a - 2) * 17;
}
}
else if (T > c&& c != a + 5)
s = (a + 1) * 60 + (T - c) * 17;
else
s = (a + 2) * 60 + (T - c) * 17;
printf("No\n%d", s);
}
return 0;
}