#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int maxm = 1e2 + 5;
const int mod = 1e9 + 7;
int n, l, m;
struct node {
  long long mi[maxm][maxm];
  void init() { memset(mi, 0, sizeof(mi)); }
} o, o1, o2, o3, e;
int a[maxn], b[maxn], c[maxn], d[maxn];
int f[maxm];
int cnt[maxm];
void get(int *w) {
  memset(cnt, 0, sizeof(cnt));
  o.init();
  for (int i = 1; i <= n; i++) cnt[w[i] % m]++;
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++) o.mi[j][(j + i) % m] = cnt[i];
}
void mul(node a, node b) {
  memset(o.mi, 0, sizeof(o.mi));
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++)
      for (int k = 0; k < m; k++) {
        o.mi[i][k] = (o.mi[i][k] + a.mi[i][j] * b.mi[j][k] % mod) % mod;
      }
}
int main() {
  scanf("%d%d%d", &n, &l, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]), c[i] += b[i];
  memset(f, 0, sizeof(f));
  memset(e.mi, 0, sizeof(e.mi));
  for (int i = 0; i < m; i++) e.mi[i][i] = 1;
  f[0] = 1;
  get(a);
  o1 = o;
  get(b);
  o2 = o;
  l -= 2;
  while (l > 0) {
    if (l & 1) {
      mul(e, o2);
      e = o;
    }
    mul(o2, o2);
    o2 = o;
    l >>= 1;
  }
  get(c);
  o3 = o;
  mul(o1, e);
  o1 = o;
  mul(o1, o3);
  o1 = o;
  printf("%lld", o1.mi[0][0]);
}
