Python 3, 114 110 109109 116 bytes
Actually would have taken two bytes less in Python 2 because exec
is a statement and doesn't need parentheses...
Saved 4 extra bytes thanks to @ElPedro
Saved an extra byte by taking advantage of the fact that
find
returns -1 on error, which can then be used as an index+7 bytes because I hadn't noticed the no-newlines rule :(
i=0;exec(";".join("i+=1 i-=1 i*=2 i/=2 print(i,end='') exit()".split()["idmhP".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...