If I understand you correctly, you want to sum your result based on the priority value? If so, give this formula a try. Using INDEX/MATCH you can first locate the index position based on a lookup value then reference the corresponded value based on a different column.
=((K2*4)+(L2*3)+(M2*2)+(N2*1))*INDEX($L$17:$L$19,MATCH(H2,$K$17:$K$19,0))