Houses
In the country, there is a plan to build a city for programmers called Oskolkovo. This city is designed to be large, featuring N streets, each containing a_i houses. The government has decided to innovate by using binary numbers for house numbering instead of the traditional system.
After this numbering system was approved for Oskolkovo, a tender was conducted to produce plates with the digits 0 and 1. The winning company charges a hryvnias for a plate with the digit 0 and b hryvnias for a plate with the digit 1. Now, the government needs to calculate the total cost of producing these plates for all the houses.
Input
The first line of the input contains three natural numbers: N (1 ≤ N ≤ 100), and a, b (1 ≤ a, b ≤ 100), representing the number of streets in the city and the costs of producing the digits 0 and 1, respectively.
The following N lines each start with a natural number a_i (1 ≤ a_i ≤ 100), indicating the number of houses on that street. Each of these lines is followed by a_i natural numbers c_j (1 ≤ c_j ≤ 100), which are the house numbers for which plates need to be produced. Note that multiple plates may be required for a single house.
Output
Output a single natural number representing the total cost of producing all the plates.