import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { static final int MOD = 998244353; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int[] dp = new int[n * 2 + 7]; dp[0] = 1; for (int i = 0; i < n * 2; i++) { for (int j = 1; j <= 6; j++) { dp[i + j] += dp[i]; dp[i + j] %= MOD; } } int[] fp = new int[n * 2 + 7]; for (int i = 0; i < 6; i++) { fp[n * 2 + i] = 1; } for (int i = n * 2 + 5; i > 0; i--) { for (int j = 1; j <= 6; j++) { if (i - j >= 0 && i - j < n * 2) { fp[i - j] += fp[i]; fp[i - j] %= MOD; } } } String result = IntStream.range(0, k).mapToObj(i -> { int x = sc.nextInt(); long ans = ((dp[x] * fp[x] % MOD + dp[x + n] * fp[x + n] % MOD) % MOD + MOD - dp[x] * dp[n] % MOD * fp[x + n] % MOD) % MOD; return String.valueOf(ans); }).collect(Collectors.joining("\n")); System.out.println(result); } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }