program Zadatak5;

uses
    Classes,
    SysUtils,
    math;

procedure SplitText(const s: String; StringList: TStringList);
begin
    StringList.Delimiter := ' ';
    StringList.DelimitedText := s;
end;

var
    mnLine, bLine, cLine: String;
    mnList, bList, cList: TStringList;
    A, B: array of LongInt;
    M, N, C: LongInt;
    x: LongInt = 0;
    temp: LongInt = 0;
    code: integer = 0;
    i,j: integer;

begin
    readln(mnLine);
    mnList := TStringList.create;
    SplitText(mnLine, mnList);
    Val(mnList.ValueFromIndex[0], N, code);
    Val(mnList.ValueFromIndex[1], M, code);

    readln(bLine);
    bList := TStringList.create;
    SplitText(bLine, bList);
    setLength(B, M);
    for i := 0 to M-1 do
    begin
        Val(bList.ValueFromIndex[i], B[i+1], code);
    end;

    readln(cLine);
    cList := TStringList.create;
    SplitText(cLine, cList);
    Val(cList.ValueFromIndex[0], C, code);

    setLength(A, N);
    for i := 1 to N do
    begin
        A[i] := i;
    end;

    for i := 0 to N-M do
    begin
        for j := 1 to M do
        begin
            A[i + B[j]] := A[i+j];
        end;
    end;

    for i := 1 to N do
    begin
        Val(FloatToStr(Power(C, i)), temp, code);
        x := x + temp * A[i];
    end;
    x := x mod 998244353;
    writeln(x);
    readln;
end.