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