#include <bits/stdc++.h>
using namespace std;
struct mat {
  int m[210][210];
  int n;
  mat(int N) {
    memset(m, 0, sizeof(m));
    n = N;
  }
};
mat I(210), B(210);
mat operator*(mat &a, mat &b) {
  int n = a.n;
  mat c(n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        long long dodati = (a.m[i][k] * 1LL * b.m[k][j]);
        if (dodati >= 1000000007) dodati %= 1000000007;
        c.m[i][j] += dodati;
        if (c.m[i][j] >= 1000000007) c.m[i][j] %= 1000000007;
      }
    }
  }
  return c;
}
mat operator^(mat &a, long long k) {
  mat c(a.n);
  c = I;
  while (k > 0) {
    if (k & 1) {
      c = c * a;
    }
    k /= 2;
    a = a * a;
  }
  return c;
}
int n;
long long k;
vector<int> state;
vector<int> operator*(vector<int> &v, mat a) {
  int n = int((v).size());
  vector<int> rez;
  for (int i = 0; i < n; i++) {
    long long sum = 0;
    for (int j = 0; j < n; j++) {
      sum += (1LL * v[j] * a.m[j][i]) % 1000000007;
      if (sum >= 1000000007) sum %= 1000000007;
    }
    rez.push_back(sum);
  }
  return rez;
}
int a[1000010], b[1000010], c[1000010], cnt[210];
int main() {
  int n, l, m;
  scanf("%d%d%d", &n, &l, &m);
  for (int i = 0; i < m; i++) state.push_back(0);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]), state[a[i] % m]++;
  for (int i = 0; i < n; i++) scanf("%d", &b[i]), cnt[b[i] % m]++;
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  for (int i = 0; i < m; i++) I.m[i][i] = 1;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      int idx = (m + j - i) % m;
      B.m[i][j] = cnt[idx];
    }
  }
  state = state * (B ^ (l - 2));
  int rez = 0;
  for (int i = 0; i < n; i++) {
    int cur = (c[i] + b[i]) % m;
    rez += state[(m - cur) % m];
    rez %= 1000000007;
  }
  printf("%d", rez);
  return 0;
}
