Topical
문제
Benson the Rabbit is attending pilot school!
He has modules to complete, numbered from to . There are topics in flying numbered from to . As Benson is new to flying, he starts with zero knowledge in each topic.
Each of these modules have a knowledge requirement to complete them. In particular, to complete module , Benson requires at least knowledge of topic for all topics .
Completing a module also allows Benson to gain knowledge in some topics. After completing module , he will gain knowledge in topic .
Formally, let Benson’s knowledge in topic be . Initially, for all . He can only complete a module if p[j] ≥ r[i][j] for every topic . After completing module , the value of increases by for each topic .
Benson may complete the modules in any order, but each module may only be completed at most once. Help Benson determine the maximum number of modules he can complete.
입력
The first line of input contains space-separated integers, and .
Then, lines will follow. The -th (1 ≤ i ≤ n) of these lines contains spaced integers , denoting the knowledge requirements to complete module .
Another lines follow. The -th (1 ≤ i ≤ n) of these lines contains spaced integers , denoting the knowledge gained after completing module .
출력
The output should contain one integer, the maximum number of modules Benson can complete.
예제
예제 1
3 3 0 0 0 7 9 2 7 8 9 7 8 2 7 7 7 8 10 9
1
예제 2
4 3 5 1 0 0 1 5 0 0 0 7 7 7 0 5 6 1 1 1 8 2 0 8 1 4
4
예제 3
5 5 14 11 15 7 15 0 0 0 0 0 9 9 14 2 13 4 3 6 1 0 2 4 7 0 0 5 5 0 0 13 4 4 7 1 0 4 1 0 2 1 2 5 0 2 1 4 0 7 2 12
4