from heapq import heapify, heappop, heappush N,C = map(int, input().split()) P = [] for _ in range(N): p = int(input()) P.append(p) P.sort(reverse = True) #print(P) T = []; X = [] for _ in range(C): t,x = map(int,input().split()) T.append(t); X.append(x) XF = []; XP = [] for i in range(C): if T[i] == 1: XF.append(X[i]) else: XP.append(X[i]) XF.sort(reverse=True); CF = len(XF) XP.sort(reverse=True) #print(XF) #print(XP) All = sum(P) #dp[i][j]: i番目まで見てj個値引を使ったときの値引き額の最大 dp = [[0]*(CF+1) for _ in range(N+1)] for i in range(N): for j in range(CF+1): jp = i - j if jp < 0: continue if j+1 < CF + 1: dp[i+1][j+1] = max(dp[i][j+1], dp[i][j] + min(P[i],XF[j])) #i個目に値引きを使う #else: # dp[i+1][j] = max(dp[i][j], dp[i][j]) if jp < len(XP): #print("P",i,j,dp[i][j]) dp[i+1][j] = max(dp[i][j], dp[i][j] + P[i]*XP[jp]//100) #i個目に割引を使う else: #print("N",i,j,dp[i][j]) dp[i+1][j] = max(dp[i][j], dp[i][j]) #print(dp) ans = All - max(dp[N]) print(ans)