#Lutece2331. 双十一

双十一

Migrated from Lutece 2331 双十一

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

pic

一年一度的双十一又来了,bensanhuan 想要买好多东西。

她想买的物品一共有 nn 个,编号为 11 号到 nn 号。现有 mm 个商店,同一个物品在不同的商店中价格可能不同,还可能有缺货的情况。

她现在知道每个物品在不同商店的价格,请你告诉她,她最少需要多少钱才能够买下所有东西。

Input

第一行有两个数 nn, mm (1n,m1001 \le n,m \le 100)。

接下来 mm 行,每一行有 nn 个整数,第 ii 行中第 jj 个整数表示第 ii 个商店中 jj 号物品的价格,每个物品的价格均是正整数且不超过 100100。如果缺货用 1-1 表示。

数据保证每个物品都能买到。

Output

一个整数,表示 bensanhuan 最少需要的钱。

Samples

4 5
10 4 1 1
8 2 9 4
3 -1 3 9
7 8 -1 5
5 1 7 9
6

Resources

电子科技大学第十一届 ACM 趣味程序设计竞赛