只能想到这种方法了
#include <iostream>
#include <iomanip>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
int main(){
int a1,a2,b1,b2,c1,c2,q,qa,qb,qc;
cin>>q>>a1>>a2>>b1>>b2>>c1>>c2;
qa=q/a1+1,qb=q/b1+1,qc=q/c1+1;
cout<<min(min(qa*a2,qb*b2),qc*c2);
return 0;
}