import sys input = sys.stdin.readline n,c = map(int,input().split()) p = [int(input()) for i in range(n)] p.sort(reverse=True) hiki = [] wari = [] for i in range(c): t,x = map(int,input().split()) if t == 1: hiki.append(x) else: wari.append(x) hiki.sort(reverse=True) wari.sort(reverse=True) if len(hiki)+len(wari) < n: for i in range(n-c): hiki.append(0) wari.append(0) c = n INF = 10**15 # i番目で、既にhikiをj枚使っている時の値段 dp = [[INF]*(len(hiki)+1) for i in range(n+1)] dp[0][0] = 0 for i in range(n): for j in range(min(i,len(hiki))+1): if j < len(hiki): dp[i+1][j+1] = min(dp[i+1][j+1],dp[i][j]+max(0,p[i]-hiki[j])) if i-j < len(wari): dp[i+1][j] = min(dp[i+1][j],dp[i][j]+p[i]//100*(100-wari[i-j])) ans = min(dp[n]) print(ans)