#include using namespace std; typedef long long ll; int main() { int A, B; cin >> A >> B; A %= 12; double t1 = (6 * B) % 360; double t2 = (30 * A) % 360 + (double)B / 2.0; //cout << t1 << " " << t2 << "\n"; int f1 = 2 * 6 * B; int f2 = 2 * 30 * A + B; if (t1 > t2) { cout << (360 - (f1 - f2)) * 60 / 11 << "\n"; } else { cout << (f2 - f1) * 60 / 11 << "\n"; } // cout << (360 - (f1 - f2)) * 60 / 11 << "\n"; // cout << (f2 - f1) * 60 / 11 << "\n"; return 0; }