#include <bits/stdc++.h>
using namespace std;
int n, l, m;
int c[3][1000005];
long long ways[105], ans[105];
long long res[105];
void combine(long long* a, long long* b) {
  memset(res, 0, sizeof res);
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      res[(i + j) % m] += a[i] * b[j] % 1000000007;
      res[(i + j) % m] %= 1000000007;
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &l, &m);
  l -= 2;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &c[i][j]);
    }
  }
  for (int i = 0; i < n; i++) {
    c[2][i] += c[1][i];
    c[2][i] %= m;
  }
  for (int i = 0; i < n; i++) {
    ways[c[1][i]]++;
    ans[c[0][i]]++;
  }
  while (l) {
    if (l & 1) {
      combine(ans, ways);
      copy(res, res + m, ans);
    }
    l >>= 1;
    combine(ways, ways);
    copy(res, res + m, ways);
  }
  memset(ways, 0, sizeof ways);
  for (int i = 0; i < n; i++) {
    ways[c[2][i]]++;
  }
  combine(ans, ways);
  copy(res, res + m, ans);
  printf("%lld\n", ans[0]);
  return 0;
}
