P3027 [USACO10OCT] Making Money G

Description

FJ has gone into the curio business, buying and selling knickknacks like cow Christmas tree ornaments. He knows he will sell every single curio he can stock from a catalog of N (1

Input Format

\* Line 1: Two space-separated integers: N and M \* Lines 2..N+1: Line i+1 contains two space-separated integers: C\_i and R\_i

Output Format

\* Line 1: The maximum profit FJ can generate given the costs and revenues