/*
TASK:socks
LANG:C++
*/
#include <iostream>
#include <iomanip>
using namespace std;
int tempb;
double total =0;
int main()
{
unsigned long int soks;
int N;
cin>>N>>soks;
unsigned long int* soker = new unsigned long int[N+1];
soker[0] =1;
int i;
for( i=0; i<N; i++)
	{
		cin>>soker[i+1];
		soker[i+1] = soker[i+1]*soker[i];
	}
double* price = new double[N+1];
for(i =0; i<4; i++)
	{
		cin>>price[i];
	}
for(int a=N; a>=0; a--)
{			
		if(soker[a] >soks)
			 tempb=0;
		else {	
		    tempb = soks/soker[a];
			soks =soks - tempb*soker[a];
			total = total + price[a];		
			
		}
		if(tempb == 0)
		{
			total = total + price[a];
			soks = 0;
			break;
		}
		
}
cout<<setprecision(2)<<fixed<<total<<"\n";

return 0;

}

