Company: Airtel_24sep
Difficulty: medium
Perfume Factory Problem Description At a perfume factory, every perfume bottle goes through three processes after each other, i.e., Distillation -> Enfleurage -> Extraction. The factory has P Distillation, Q Enfleurage, and R Extraction machines. Each machine can process only a single product at any time, and it takes T1 hours for Distillation, T2 hours for Enfleurage, and T3 hours for Extraction. Your task is to print the minimum hours required to produce N perfume bottles. Input Format The input consists of two lines: The first line contains an integer N, representing the number of perfume bottles. The second line contains six space-separated integers P, Q, R, T1, T2, T3. The input will be read from the STDIN by the candidate. Output Format Print the minimum hours required to prepare N perfume bottles. The output will be matched to the candidate's output printed on the STDOUT. Constraints 1 ≤ N ≤ 10000 1 ≤ P, Q, R, T1, T2, T3 ≤ 1000 Examples Example 1: Input: 8 4 3 2 10 5