Today HNU is holding the hucpc2021. Yuki is very excited and wants to attend this amazing contest. Unfortunately, the contest needs a team to participate. Yuki can register a team only himself. However, yuki is too weak and he does not want to compete with other teams only himself. Therefore poor yuki asks volunteers for help. After the volunteer's introduction, yuki knows a genius person called playf, who already registered a team with a single person. Poor yuki finds playf and tells playf about his embarrassing situation. Playf is a generous and kind-hearted man. He is so glad and decides to let yuki join his team. After 5 hours of exciting competition, there is no doubt that genius playf wins the champion in hucpc2021! Yuki is a really lucky dog because he has done nothing in the whole competition. Poor yuki is so curious why playf so strong and asks playf for some life experiences. playf is a very generous man so he tells yuki a lot. After that, yuki knows that playf is not only a genius but also a city traveller, and yuki is very interested in playf's city travel experiences. The most interesting city travel yuki think is following:
Long long ago, playf travelled in a country with

cities and he got

diamonds when he travelled around these cities. Playf was such generous and kind-hearted man, so he wanted to donate the diamonds for helped as much as people he could. After playf investigated, he found that

-th diamond had a price

and one unit price could buy

bread in

-th city, which was mean

-th diamond in

-th city could exchange

bread, so playf decided to sold these diamonds to bought bread, then he distributed all the bread to people. But there were some rules in this country, for protected trading environment, every traveller at most sold one diamond in a city and the bread had bought in a city could not bring to other cities, for equity and satisfied three meals a day of one person, the number of bread
distributed to each person should same and at least three, in other words, there are

bread can distribute to y guys if

and

.And playf wanted to distribute all the bread exchanged without leave.
Playf is a genius and quickly found the solution to help as much as people, which is mean the total number of people was distributed in each city is maximized. But playf does not tell the actually number to yuki, poor yuki wants to know the number, can you help yuki?
First line contains two integers
, are mentioned in the description.
Second line contains
integers
, are mentioned in the description.
Thirdline contains
integers
,are mentioned in the description.
