#include <bits/stdc++.h>
using namespace std;
long long res[105], base[105], m;
long long T[105][105], a[105][105];
int main() {
  int n, l;
  cin >> n >> l >> m;
  int ini[n], med[n], fin[n];
  for (int &i : ini) scanf("%d", &i);
  for (int &i : med) scanf("%d", &i);
  for (int &i : fin) scanf("%d", &i);
  for (int i = 0; i < n; i++)
    fin[i] += med[i], a[med[i] % m][0]++, base[fin[i] % m]++;
  for (int j = 1; j < m; j++)
    for (int i = 1; i <= m; i++) a[i % m][j] = a[(i - 1) % m][j - 1];
  for (int i = 0; i < m; i++) T[i][i] = 1;
  int e = l - 2;
  while (e) {
    long long c[m][m];
    if (e & 1) {
      memset(c, 0, sizeof c);
      for (int i = 0; i < m; i++)
        for (int j = 0; j < m; j++)
          for (int k = 0; k < m; k++)
            c[i][j] = (c[i][j] + a[i][k] * T[k][j]) % 1000000007ll;
      for (int i = 0; i < m; i++)
        for (int j = 0; j < m; j++) swap(c[i][j], T[i][j]);
    }
    memset(c, 0, sizeof c);
    for (int i = 0; i < m; i++)
      for (int j = 0; j < m; j++)
        for (int k = 0; k < m; k++)
          c[i][j] = (c[i][j] + a[i][k] * a[k][j]) % 1000000007ll;
    for (int i = 0; i < m; i++)
      for (int j = 0; j < m; j++) swap(a[i][j], c[i][j]);
    e /= 2;
  }
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++)
      res[i] = (res[i] + T[i][j] * base[j]) % 1000000007ll;
  long long ans = 0;
  for (int i = 0; i < n; i++)
    ans = (ans + res[(m - ini[i]) % m]) % 1000000007ll;
  cout << ans << endl;
  return 0;
}
