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