#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
 
int main ()
{  
    
    int s = 2;
    vector<int> vp(s);
    for (int i=0; i<s; i++ ){
        cin >> vp[i];
    }
    int n = vp[0];
    int m = vp[1];
   
    
    vector<int> b(m);
    for (int i=0; i<m; i++ ){
        cin >> b[i];
    }
    double c;
   
    
    cin >> c;
 
    
    vector<int> a(n);
    for (int i=0; i<=n; i++ ){
        a[i] = i;
    }
   
    
    for (int i=0; i<=(n - m); i++ ){
        for (int j=1; j<=m; ++j ){
            a[i + b[j-1]] = a[i + j];
        }
    }
 
   
    int sum = 0;
    for (int i=1; i<=n; i++ ){
        sum = sum + (a[i] * int(pow(double(c),double(i))));
    }
    int izlaz = sum%998244353;
    cout << izlaz;
  return 0;
}