program takmicenje2zad5;
var n, m, c, cc, x:int64
i, j: integer;
a, b:array [1..50000] of int64;
begin
x := 0;
read(n,m);
for i := 1 to m do read(b[i]);
read(c);
cc := c;
for i := 1 to n do a[i] := i;
for i := 0 to n-m do for j := 1 to m do a[i + b[j]] := a[i + j];
for i := 1 to n do
begin
x := x + c*a[i];
c := c*cc;
end;
writeln(x);
end.