#include using namespace std; #define int long long typedef pair P; int INF = 5e18+7; int mod = 1e9+7; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; long double pi = 3.141592653589793238; signed main() { int A,B; cin >> A >> B; int a = (A*30+B/2)%360; int b = (6*B)%360; if(a == b) { cout << 0 << endl; } else { cout << ((a+360-b)%360*120+B%2*60)/11 << endl; } }