#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
const int MOD = 1e9 + 7;
const int N = 1e6 + 7;
int n, l, m;
struct Matrix {
  long long c[101][101];
  Matrix() { memset(c, 0, sizeof(c)); }
  Matrix operator*(const Matrix &rhs) const {
    Matrix r;
    for (int i = int(0); i <= int(m - 1); ++i)
      for (int k = int(0); k <= int(m - 1); ++k)
        for (int j = int(0); j <= int(m - 1); ++j)
          r.c[i][j] += c[i][k] * rhs.c[k][j] % MOD, r.c[i][j] %= MOD;
    return r;
  }
  Matrix operator^(long long b) {
    Matrix r;
    for (int i = int(0); i <= int(m - 1); ++i) r.c[i][i] = 1;
    while (b) {
      if (b & 1) r = r * (*this);
      (*this) = (*this) * (*this);
      b >>= 1;
    }
    return r;
  }
} A, B;
int a[N];
int main() {
  scanf("%d%d%d", &n, &l, &m);
  for (int i = int(1); i <= int(n); ++i) {
    int x;
    scanf("%d", &x);
    A.c[0][x]++;
  }
  for (int i = int(1); i <= int(n); ++i) {
    int x;
    scanf("%d", &x);
    a[i] = x;
    for (int j = int(0); j <= int(m - 1); ++j) B.c[j][(j + x) % m]++;
  }
  B = B ^ (l - 2);
  A = A * B;
  long long ans = 0;
  for (int i = int(1); i <= int(n); ++i) {
    int x;
    scanf("%d", &x);
    ans += A.c[0][(2 * m - x - a[i]) % m];
    ans %= MOD;
  }
  cout << ans << endl;
}
