Python 3, 114 110 bytes
Saved 4 extra bytes thanks to @ElPedro
i=0;exec(";".join("i+=1 i-=1 i*=2 i/=2 print(i) exit()".split()["idmhPe".find(h[0])]for h in input().split()))
Maps the first character of every input word to a piece of Python code. These are then concatenated and exec
ed.
Pretty straightforward approach, that could probably be golfed a bit more. The difficulty mostly resides in finding the shortest form out of many possible ones...