#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
vector<vector<long long> > mul(vector<vector<long long> > a,
                               vector<vector<long long> >& b) {
  vector<vector<long long> > c(a.size(), vector<long long>(b[0].size()));
  for (int i = 0; i < (a.size()); i++)
    for (int j = 0; j < (b[0].size()); j++)
      for (int k = 0; k < (b.size()); k++)
        (c[i][j] += a[i][k] * b[k][j]) %= MOD;
  return c;
}
vector<vector<long long> > ppow(vector<vector<long long> >& a, int b) {
  vector<vector<long long> > res(a.size(), vector<long long>(a.size()));
  for (int i = 0; i < (a.size()); i++) res[i][i] = 1;
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
int a[2000000], b[2000000], c[2000000];
int main() {
  int n, L, m;
  cin >> n >> L >> m;
  for (int i = 0; i < (n); i++) scanf("%d", &a[i]);
  for (int i = 0; i < (n); i++) scanf("%d", &b[i]);
  for (int i = 0; i < (n); i++) scanf("%d", &c[i]);
  vector<vector<long long> > A(m, vector<long long>(m));
  for (int i = 0; i < (m); i++)
    for (int j = 0; j < (n); j++) {
      A[i][(i + b[j]) % m]++;
    }
  A = ppow(A, L - 2);
  vector<vector<long long> > S(m, vector<long long>(m)),
      T(m, vector<long long>(m));
  for (int i = 0; i < (n); i++) {
    S[0][a[i] % m]++;
  }
  for (int i = 0; i < (m); i++)
    for (int j = 0; j < (n); j++) {
      T[i][(i + b[j] + c[j]) % m]++;
    }
  vector<vector<long long> > res = mul(mul(S, A), T);
  cout << res[0][0] << endl;
}
