Program Problem_B;
{$APPTYPE CONSOLE}
uses
  SysUtils;

Var
  n: Integer;
  m: Integer;
  k: Integer;
  l: Integer;
  i: Integer;
  j: Integer;
  q: Integer;
  w: Int64;
  a: Array [1..100] of Boolean;
  b: Array [1..10] of Integer;
  tf: Boolean;
Begin
  w := 0;
  for i := 1 to 100 do
    a[i] := True;
  Assign(input, 'B.in');
  Reset(input);
  Read(input, n);
  Read(input, m);
  Read(input, k);
  Read(input, l);
  for i := 1 to l do
    Read(input, b[i]);
  Close(input);
  if n > m then
  begin
    i := 1;
    j := 1;
    while j < 11 do
    begin
      tf := True;
      for q := 1 to l do
        if not a[i + b[q] - 1] then
          tf := False;
      if tf then
      begin
        for q := 1 to l do
          a[i + b[q] - 1] := False;
        Inc(j);
      end
      else
        Inc(i);
    end;
    w := (n div 10) * (i + k);
    n := n mod 10;
    for i := 1 to 100 do
      a[i] := True;
  end;
  i := 1;
  j := 1;
  while j < n do
  begin
    tf := True;
    for q := 1 to l do
      if not a[i + b[q] - 1] then
        tf := False;
    if tf then
    begin
      for q := 1 to l do
        a[i + b[q] - 1] := False;
      Inc(j);
    end
    else
      Inc(i);
  end;
  w := w + i + k;
  Assign(output, 'B.out');
  ReWrite(output);
  Write(output, w);
  Close(output);
End.
