#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1000100;
const int mod = 1e9 + 7;
int n, l, m;
int a[N], b[N], c[N];
struct matrix {
  int rowSize = 101;
  int columnSize = 101;
  ll data[101][101];
  matrix() {
    for (int i = 0; i < rowSize; i++) {
      for (int j = 0; j < columnSize; j++) {
        data[i][j] = 0;
      }
    }
  }
  matrix operator*(const matrix other) const {
    assert(columnSize == other.rowSize);
    matrix result = matrix();
    for (int i = 0; i < rowSize; i++) {
      for (int j = 0; j < other.columnSize; j++) {
        for (int k = 0; k < columnSize; k++) {
          result.data[i][j] =
              result.data[i][j] + 1ll * data[i][k] * other.data[k][j] % mod;
        }
        result.data[i][j] = (result.data[i][j] + mod) % mod;
      }
    }
    result.rowSize = rowSize;
    result.columnSize = other.columnSize;
    return result;
  }
  matrix power(int e) {
    if (e == 1) return *this;
    if (e & 1) return (*this) * power(e - 1);
    matrix half = power(e >> 1);
    return half * half;
  }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  matrix I = matrix();
  I.rowSize = m;
  I.columnSize = m;
  for (int i = 0; i < m; i++) {
    for (int j = 1; j <= n; j++) {
      int nj = ((i - b[j]) % m + m) % m;
      I.data[nj][i]++;
    }
  }
  matrix A = matrix();
  if (l > 2) A = I.power(l - 2);
  I = matrix();
  I.rowSize = 1;
  I.columnSize = m;
  for (int i = 1; i <= n; i++) I.data[0][(a[i] % m)]++;
  if (l > 2) I = I * A;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + I.data[0][(2 * m - c[i] - b[i]) % m]) % mod;
  }
  cout << ans << '\n';
}
