#include <bits/stdc++.h> using namespace std; double n; double minn=1e8+100,z,x; int main(){ cin>>n; for(int i=0;i<3;i++){ cin>>z>>x; minn=min(x*ceil(n/z*1.0),minn); } cout<<minn; return 0; }