#include <iostream>
using namespace std;

int main(int argc, char** argv) {
	int n,m,c,p;
	cin>>n>>m;
	
	unsigned long long x = 0;
	long long b[100000];
	long long a[100000];
	
	
	for(int i = 1; i<=m;i++){
		
		cin>>b[i];
		
	}
	cin>>c;
	int cc = c;
	p = n-m;
	for (int i = 0;i<=p;i++){
		
	a[i]=i;
}
for(int i = 0; i<=p;i++){

	
	for (int j=1; j<=m; j++){
	a[i + b[j]] = a[i + j];
}

}


for(int i = 1;i<=n;i++){
	
if (i>=2){
		cc = cc*c;
		
}
	x = x + cc *a[i];
	
}
cout<<x;

	return 0;
}