P3027 [USACO10OCT] Making Money G

Background

FJ又经营起了古董生意,买卖一些像奶牛圣诞树上的装饰之类的小玩意。他知道他会将他能存储的N(1

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