Time limit
2s
Memory limit
128 MB
Sejun has spent a long time in the hospital after surgery. Now he wants to thank the people who cared about him while he was hospitalized.
There are N people, numbered from 1 to N. If Sejun greets person i, he loses L[i] health and gains J[i] joy. He can greet each person at most once.
Sejun starts with 100 health and 0 joy. If his health becomes 0 or negative, he cannot feel any joy. Choose whom he greets so that his health remains positive, and find the maximum joy he can gain.
The first line contains the number of people, N. (N <= 20)
The second line contains the health losses L[i] for people 1 through N, in order.
The third line contains the joy values J[i] for people 1 through N, in order.
Every health loss and joy value is an integer between 0 and 100, inclusive.
Print the maximum joy Sejun can gain.