You are a philatelist studying a series of unique postage stamps. Some of these stamps are already in your collection, while others are available for purchase. For each stamp, you are given its price (the amount of dollars to buy it, or the amount for which you could sell it) and its collection value (which depends on your subjective criteria and is independent of its monetary value).
You may sell any stamps from this series that you currently own, and buy any that you do not have.
Your goal is to obtain a collection of stamps from this series with a total collection value of at least . What is the minimum amount of money you must spend to achieve this? Note that it may be possible to spend , or even make a profit, depending on your transactions.
The first line contains two integers and (1 \leq n \leq 32, 1 \leq k \leq 10^9), separated by a space.
The second line contains integers p_1, p_2, \dotsc, p_n (p_i is the cost of the -th stamp).
The third line contains integers h_1, h_2, \dotsc, h_n, where h_i = 1 if you already own the -th stamp, and otherwise.
The fourth line contains integers v_1, v_2, \dotsc, v_n (v_i is the collection value of the -th stamp).
Output a single integer — the minimum amount of money you must spend to obtain a collection of stamps from this series with a total collection value of at least .
If it is possible to achieve this value without spending any additional money, or even by making a profit from transactions, output .
If it is impossible to achieve the desired collection value with any additional investment, output .
Esempio 1
Esempio 2
Esempio 3
Esempio 4