#include using namespace std; int main(){ int a, b; cin >> a >> b; long double lo = 6 * b; long double sh = 30 * a + 0.5 * b; if(sh < lo) sh += 360; sh -= lo; long double ans = sh/(5.5/60); cout << (int)ans << endl; return 0; }