#include using namespace std; int main() { int m, d; cin >> m >> d; cout << ((m == 4 && d == 1) ? m + d + 1 : m + d) << endl; }