n,m = list(map(int,input().split())) hf = (n-1)+n*(m-1) vf = (m-1)+m*(n-1) res = min(hf,vf) print(res)