#include <bits/stdc++.h>
using namespace std;

int main() {
    int m, d;
    cin >> m >> d;
    if (m <= 7) {
        cout << 23 << endl;
    } else if (m == 8) {
        cout << (d < 22 ? 23 : 24) << endl;
    } else {
        cout << 24 << endl;
    }
}