#include <iostream>
using namespace std;

int main() {
    int M, D;
    cin >> M >> D;
    if (M <= 7) {
        cout << 23 << endl;
    } else if (M == 8) {
        if (D <= 21) {
            cout << 23 << endl;
        } else {
            cout << 24 << endl;
        }
    } else {
        cout << 24 << endl;
    }
}