CF799D Field expansion
Description
In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of times. Formally, there are $ n $ extensions, the $ i $ -th of them multiplies the width or the length (by Arkady's choice) by $ a_{i} $ . Each extension can't be used more than once, the extensions can be used in any order.
Now Arkady's field has size $ h×w $ . He wants to enlarge it so that it is possible to place a rectangle of size $ a×b $ on it (along the width or along the length, with sides parallel to the field sides). Find the minimum number of extensions needed to reach Arkady's goal.
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first example it is enough to use any of the extensions available. For example, we can enlarge $ h $ in $ 5 $ times using the second extension. Then $ h $ becomes equal $ 10 $ and it is now possible to place the rectangle on the field.