mod = 1000000007
eps = 10**-9
inf = 10**18


def main():
    import sys
    input = sys.stdin.readline

    N, M = map(int, input().split())
    P = []
    for _ in range(N):
        P.append(int(input()))
    C1 = []
    C2 = []
    for _ in range(M):
        t, x = map(int, input().split())
        if t == 1:
            C1.append(x)
        else:
            C2.append(x)
    C1.sort(reverse=True)
    C2.sort(reverse=True)
    P.sort(reverse=True)

    if len(C1) + len(C2) < N:
        for _ in range(N - M):
            C2.append(0)
        M = N

    dp = [[inf] * (len(C1) + 1) for _ in range(N+1)]
    dp[0][0] = 0
    for i in range(N):
        p = P[i]
        for j in range(len(C1) + 1):
            # use C1
            if j != len(C1):
                dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + max(0, p - C1[j]))
            # use C2
            if 0 <= i-j < len(C2):
                dp[i+1][j] = min(dp[i+1][j], dp[i][j] + p * (100 - C2[i - j]) // 100)
    print(min(dp[-1]))


if __name__ == '__main__':
    main()