import java.io.*; import java.util.*; public class Main { static ArrayList>> dp = new ArrayList<>(); static ArrayList minus = new ArrayList<>(); static ArrayList rates = new ArrayList<>(); static int[] prices; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int c = sc.nextInt(); prices = new int[n]; for (int i = 0; i < n; i++) { prices[i] = sc.nextInt(); dp.add(new HashMap<>()); } Arrays.sort(prices); for (int i = 0; i < c; i++) { if (sc.nextInt() == 1) { minus.add(sc.nextInt()); } else { rates.add(sc.nextInt()); } } Collections.sort(minus); Collections.sort(rates); System.out.println(dfw(n - 1, minus.size(), rates.size())); } static int dfw(int idx, int mIdx, int rIdx) { if (idx < 0) { return 0; } if (!dp.get(idx).containsKey(mIdx)) { dp.get(idx).put(mIdx, new HashMap<>()); } if (dp.get(idx).get(mIdx).containsKey(rIdx)) { return dp.get(idx).get(mIdx).get(rIdx); } int ans; if (mIdx == 0) { if (rIdx == 0) { ans = prices[idx] + dfw(idx - 1, 0, 0); } else { ans = getRate(prices[idx], rates.get(rIdx - 1)) + dfw(idx - 1, 0, rIdx - 1); } } else { if (rIdx == 0) { ans = getMinus(prices[idx], minus.get(mIdx - 1)) + dfw(idx - 1, mIdx - 1, 0); } else { ans = Math.min(getRate(prices[idx], rates.get(rIdx - 1)) + dfw(idx - 1, mIdx, rIdx - 1), getMinus(prices[idx], minus.get(mIdx - 1)) + dfw(idx - 1, mIdx - 1, rIdx)); } } dp.get(idx).get(mIdx).put(rIdx, ans); return ans; } static int getRate(int p, int r) { return p / 100 * (100 - r); } static int getMinus(int p, int m) { return Math.max(0, p - m); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }