#include <bits/stdc++.h>
using namespace std;
const int kModulo = 1e9 + 7;
const int kMaxM = 100;
long long s[kMaxM][kMaxM], c[kMaxM][kMaxM], r[kMaxM][kMaxM];
long long v[kMaxM], rv[kMaxM], v2[kMaxM];
int main() {
  vector<long long> wtf;
  int n, l, m;
  scanf("%d %d %d", &n, &l, &m);
  for (int i = 0; i < n; ++i) {
    long long x;
    scanf("%lld", &x);
    ++v[x % m];
  }
  for (int i = 0; i < n; ++i) {
    long long x;
    scanf("%lld", &x);
    for (int j = 0; j < m; ++j) ++c[j][(j + x) % m];
    wtf.push_back(x);
  }
  for (int i = 0; i < n; ++i) {
    long long x;
    scanf("%lld", &x);
    wtf[i] = (wtf[i] + x) % m;
  }
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < m; ++j) {
      if (i == j) {
        s[i][j] = 1;
      } else {
        s[i][j] = 0;
      }
    }
  }
  l -= 2;
  while (l) {
    if (l % 2) {
      for (int i = 0; i < m; ++i) {
        for (int j = 0; j < m; ++j) {
          r[i][j] = 0;
          for (int k = 0; k < m; ++k) {
            r[i][j] += s[i][k] * c[k][j];
            r[i][j] %= kModulo;
          }
        }
      }
      for (int i = 0; i < m; ++i) {
        for (int j = 0; j < m; ++j) s[i][j] = r[i][j] % kModulo;
      }
    }
    for (int i = 0; i < m; ++i) {
      for (int j = 0; j < m; ++j) {
        r[i][j] = 0;
        for (int k = 0; k < m; ++k) {
          r[i][j] += c[i][k] * c[k][j];
          r[i][j] %= kModulo;
        }
      }
    }
    for (int i = 0; i < m; ++i) {
      for (int j = 0; j < m; ++j) c[i][j] = r[i][j] % kModulo;
    }
    l >>= 1;
  }
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < m; ++j) {
      rv[j] += s[i][j] * v[i];
      rv[j] %= kModulo;
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += rv[(m - wtf[i]) % m];
    ans %= kModulo;
  }
  printf("%lld\n", ans);
  return 0;
}
