#include using namespace std; int main() { int M, D; cin >> M >> D; if (M == 4 && D == 1) cout << 1 << endl; else cout << M + D << endl; }