Fruit shop
Practice
3.5 (8 votes)
Mathematics
Very Easy
Mathematics
Mathamatics
Problem
89% Success 3580 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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.

Input format

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 \le a, b, p \le 100\)).

Second line contains three integers \(c_a\), \(c_b\) and \(c_p\) — the number of apples, the number of bananas and the number of pears available in the store (\(1 \le c_a, c_b, c_p \le 100\)).

Third line contains integer m — the number of coins John owns (\(1 \le m \le 30 000\)).

Output format

Output single integer — the maximum number of fruits John can buy.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
15 votes
Tags:
Basic MathAlgorithmsMathamaticsMath
Points:10
29 votes
Tags:
Very-Easy
Points:10
3 votes
Tags:
Very-Easy