n,c = map(int,input().split()) P = [int(input()) for i in range(n)] l = [[] for i in range(2)] for i in range(c): t,x = map(int,input().split()) if t == 1: l[0].append(x) else: l[1].append(x) P.sort(reverse=True) l[0].sort(reverse=True) l[1].sort(reverse=True) ans = sum(P) n0 = 0 n1 = 0 for p in P: dis1 = 0 dis2 = 0 if n0 < len(l[0]): dis1 = min(l[0][n0],p) if n1 < len(l[1]): dis2 = p*l[1][n1]//100 if dis1 > dis2: ans -= dis1 n0 += 1 else: ans -= dis2 n1 += 1 print(ans)