SP16409 LOPOV - Lopov

Description

The difficult economic situation in the country and reductions in government agricultural subsidy

Input Format

The first line of input contains two numbers, N and K (1 Each of the following N lines contains a pair of numbers, Mi and Vi (1 Each of the following K lines contains a number, Ci (1 All numbers in the input are positive integers.

Output Format

The first and only line of output must contain the maximum possible total jewellery value.