#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
double a, b, c, d, e, f, g, x1,x2,x3;
double min(double x, double y, double z)
{
if(y>x)
swap(x, y);
if (z > y)
swap(z, y);
if (y > x)
swap(x, y);
return z;
}
int main()
{
cin >> a >> b >> c >> d >> e >> f >> g;
x1 = ceil(a / b) * c;
x2 = ceil(a / d) * e;
x3 = ceil(a / f) * g;
cout << min(x1, x2, x3) << endl;
return 0;
}