n, c = map(int, input().split()) P = [int(input()) for _ in range(n)] P.sort(reverse = True) t1 = [] t2 = [] for _ in range(c): t, c = map(int, input().split()) if t == 1: t1.append(c) else: t2.append(c) t1.sort(reverse = True) t2.sort(reverse = True) t1 += [0] * (n - len(t1)) t2 += [0] * (n - len(t2)) inf = 1 << 30 dp = [[inf] * (n + 1) for _ in range(n + 1)] dp[0][0] = 0 for i in range(n + 1): for j in range(n + 1): if i + j > n: break p = P[i + j - 1] if i > 0: dp[i][j] = min(dp[i][j], dp[i - 1][j] + max(0, p - t1[i - 1])) if j > 0: dp[i][j] = min(dp[i][j], dp[i][j - 1] + p * (100 - t2[j - 1]) // 100) ans = inf for i in range(n + 1): ans = min(ans, dp[i][n - i]) print(ans)