John loves fruits. He eats one apple, banana or pear literally every hour.
John came to fruit shop to buy some fruits. He has m coins that he is going to spend to buy as many fruits as he can. He counted the number of apples, bananas and pears, and he also knows the price of a single apple, the price of a single banana and the price of a single pear in this shop.
Help John to buy the maximum number of fruits.
First line contains three integers a, b and p — the number of coins needed to be spend to buy one apple, one banana and one pear (1≤a,b,p≤100).
Second line contains three integers ca, cb and cp — the number of apples, the number of bananas and the number of pears available in the store (1≤ca,cb,cp≤100).
Third line contains integer m — the number of coins John owns (1≤m≤30000).
Output single integer — the maximum number of fruits John can buy.
John buys two apples and two bananas, spending 12 coins.