#include <bits/stdc++.h>
using namespace std;
int c[210];
int b[1000010];
const int MAXN = 100, MOD = 1000000007;
struct MAT {
  long long mat[MAXN][MAXN];
  MAT operator*(const MAT &a) const {
    MAT b;
    memset(b.mat, 0, sizeof(b.mat));
    for (int i = 0; i < MAXN; i++) {
      for (int j = 0; j < MAXN; j++) {
        for (int k = 0; k < MAXN; k++)
          b.mat[i][j] = (b.mat[i][j] + mat[i][k] * a.mat[k][j] % MOD) % MOD;
      }
    }
    return b;
  }
} st, ba;
MAT Mqpow(MAT base, int b) {
  MAT r;
  memset(r.mat, 0, sizeof(r.mat));
  for (int i = 0; i < MAXN; i++) r.mat[i][i] = 1;
  while (b) {
    if (b & 1) r = base * r;
    base = base * base;
    b >>= 1;
  }
  return r;
}
int main() {
  int n, m, l, x;
  scanf("%d%d%d", &n, &l, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    ba.mat[0][x % m]++;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    for (int j = 0; j < m; j++) {
      st.mat[(j - x + m) % m][j]++;
    }
    b[i] = x;
  }
  MAT ans = ba * Mqpow(st, l - 2);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    b[i] += x;
    c[b[i]]++;
  }
  long long res = 0;
  for (int k = 0; k <= m + m; k++) {
    if (c[k] == 0) continue;
    res = (res + ans.mat[0][(m + m - k) % m] * c[k] % MOD) % MOD;
  }
  cout << res << endl;
  return 0;
}
