Data Transfer
There are two computers, and you need to transfer information of size V megabytes from one computer to the other. You have two USB drives available for this task, with capacities V_1 and V_2 megabytes. Each drive has its own reading and writing speeds, R_1, R_2 and W_1, W_2 megabytes per second, respectively.
The drives have specific characteristics: reading or writing operations occur in whole seconds. Even if the remaining data is less than what can be processed in a second, the operation still takes a full second. Each computer is equipped with only one USB port, so at any given time, you can either transfer data from the computer to a drive or read data from a drive to transfer it to the computer. Your task is to determine the minimum time required to transfer the data from one computer to the other, assuming that swapping drives takes no time.
Input
The first line of the input contains a single integer V, representing the volume of information to be transferred. The next two lines each contain three numbers, detailing the parameters of each drive: first V_1, R_1, W_1, followed by V_2, R_2, and W_2. All numbers are within the range of 1 to 300, inclusive.
Output
The output should be a single number, representing the minimum time required to transfer the specified volume of data.