#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; return 0; }