#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <bits\stdc++.h>
using namespace std;

int main()
{
    cin.tie(0);
	cout.tie(0);
	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] - 1] = a[i - 1 + j];
		}
	}

	int sum = 0;
	for (int i = 1; i < n; i++) {
		sum = sum + (a[i] * int(pow(double(c), double(i))));
	}
	sum = abs(sum);
	int izlaz = sum % 998244353;
	cout << izlaz;
	return 0;
}