#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define ALL(x) (x).begin(), (x).end() const double PI = acos(-1); int main() { ios_base::sync_with_stdio(0); cin.tie(0); int h0, m0; scanf("%02d %02d", &h0, &m0); set hit; for (int h = 0; h <= 10; h++) { int t = 3600 * 12 * h / 11; hit.insert(t); } int cur = (h0 * 60 + m0) * 60; cur %= 12 * 60 * 60; for (int i = 0; ; i++) { int t = (cur + i) % (60 * 60 * 12); if (hit.count(t)) { cout << i << endl; break; } } return 0; }