#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int a[1000005];
int n, l, m;
struct st {
  long long num[105];
  st() { memset(num, 0, sizeof(num)); }
};
st q[3];
st cj(st a, st b) {
  st aa = st();
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      int k = (i + j) % m;
      aa.num[k] = (aa.num[k] + a.num[i] * b.num[j] % mod) % mod;
    }
  }
  return aa;
}
st qpow(st a, int n) {
  st sum = a;
  n--;
  while (n) {
    if (n & 1) {
      sum = cj(sum, a);
    }
    n /= 2;
    a = cj(a, a);
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(a, 0, sizeof(a));
  cin >> n >> l >> m;
  q[0] = st();
  q[1] = st();
  q[2] = st();
  int x;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    q[0].num[x % m]++;
  }
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a[i] = x;
    q[1].num[x % m]++;
  }
  for (int i = 1; i <= n; i++) {
    cin >> x;
    q[2].num[(x + a[i]) % m]++;
  }
  long long result = 0;
  st qq;
  if (l - 2 > 0) {
    qq = qpow(q[1], l - 2);
    qq = cj(qq, q[0]);
    qq = cj(qq, q[2]);
  } else {
    qq = cj(q[0], q[2]);
  }
  for (int i = 0; i <= 100; i++) {
    if (i % m == 0) {
      result = (result + qq.num[i]) % mod;
    }
  }
  cout << result << endl;
  return 0;
}
