#P1742. CNS Paper
CNS Paper
Description
As the light of mathematics, Little A, a member of ACM team, is in love with prime numbers.
Unlike those who do not study in mathematics, Little A has a specific ability, which is that he can duplicate those items numbered by prime numbers.
One day, his tutor accidentally dropped a series of CNS paper that are all unsigned in front of him and coughed a few times...
For each page in the paper has a value, greedy Little A wants to pick up as much value as possible.(Duplicated counts) Please help him.
Input Format
There will be integers , in the first line, denoting the amount of different papers and the space of Little A's hand.
For the following line, each line contains integers and , (), denoting space cost and value of each page in the specific paper.
Hint: Papers are numbered from .
Output Format
Print the maximum value of the papers Little A can get in a single line.
3 10
1 5
2 5
1 1
26