#include #include using namespace std; #define modulo 1000000007 #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000 int main(){ vector> t = {{0,0,0},{1,5,27},{2,10,54},{3,16,21},{4,21,49},{5,27,16},{6,32,43},{7,38,10},{8,43,38},{9,49,5},{10,54,32}}; vector S; rep(i,t.size()*10){ S.push_back(t[i%11][0]*3600+t[i%11][1]*60+t[i%11][2]); rep(j,t.size()/11){ S.back() += 3600 * 12; } } int A,B; cin>>A>>B; int C = B*60 + A*3600; cout<<(*lower_bound(S.begin(),S.end(),C)) - C<