#include <bits/stdc++.h>
using namespace std;
inline long long int add(long long int x, long long int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
  return x;
}
inline long long int mul(long long int x, long long int y) {
  return (x * y) % 1000000007;
}
struct matrix {
  long long int m[105][105];
  matrix() {
    for (int i = 0; i <= 100; i++) {
      for (int j = 0; j <= 100; j++) m[i][j] = 0;
    }
  }
} mat;
matrix mul(matrix a, matrix b) {
  matrix c;
  for (int i = 0; i <= 100; ++i) {
    for (int j = 0; j <= 100; ++j) {
      c.m[i][j] = 0;
      for (int p = 0; p <= 100; ++p) {
        c.m[i][j] = add(c.m[i][j], mul(a.m[i][p], b.m[p][j]));
      }
    }
  }
  return c;
}
matrix pow(matrix base, long long int exponent) {
  matrix result;
  for (int i = 0; i <= 100; ++i) result.m[i][i] = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = mul(result, base);
    exponent = exponent >> 1;
    base = mul(base, base);
  }
  return result;
}
int cost[1000005], exitt[1000005], entry[1000005], a[105];
long long int b[105];
int main() {
  int n, l, m, i, j, k, x, y;
  long long int ans = 0;
  scanf("%d%d%d", &n, &l, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d", &entry[i]);
    entry[i] %= m;
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &cost[i]);
    cost[i] %= m;
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &exitt[i]);
    exitt[i] %= m;
  }
  for (i = 0; i <= m - 1; i++) {
    for (j = 1; j <= n; j++) {
      x = (i + cost[j]) % m;
      mat.m[i][x]++;
    }
  }
  mat = pow(mat, l - 2);
  for (i = 1; i <= n; i++) a[entry[i]]++;
  for (i = 0; i <= m - 1; i++) {
    for (j = 0; j <= m - 1; j++) b[i] = add(b[i], mul(a[j], mat.m[j][i]));
  }
  for (i = 0; i <= m - 1; i++) {
    for (j = 1; j <= n; j++) {
      x = (i + cost[j] + exitt[j]) % m;
      if (x == 0) ans = add(ans, b[i]);
    }
  }
  printf("%lld", ans);
  return 0;
}
