#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int a, b; cin >> a >> b; vector ans; rep(i, 12) ans.push_back(i * 12 * 60 * 60 / 11); Debug(ans); int now = (a * 3600 + b * 60) % (12 * 60 * 60); for (auto x : ans) { if (x >= now) { cout << x - now << endl; break; } } return 0; }