m,d=map(int,input().split()) if m==4 and d==1: print("-1") else: print(m+d)