#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
const int MAXM = 1000005;
const int MOD = 1000000007;
const int MAMOD = 998244353;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double EPS = 1e-8;
struct mat {
  long long m[MAXN][MAXN];
  void init() { memset(m, 0, sizeof(m)); }
} s, x, t, unit;
mat operator*(mat a, mat b) {
  mat ret;
  long long x;
  for (int i = 0; i < 100; i++)
    for (int j = 0; j < 100; j++) {
      x = 0;
      for (int k = 0; k < 100; k++) x += ((a.m[i][k] * b.m[k][j]) % MOD);
      ret.m[i][j] = x % MOD;
    }
  return ret;
}
mat quickpow(mat a, long long x) {
  mat ans = unit;
  for (int i = 0; i < MAXN; ++i) ans.m[i][i] = 1;
  while (x) {
    if (x & 1) ans = ans * a;
    a = a * a;
    x >>= 1;
  }
  return ans;
}
int a[MAXM], b[MAXM], c[MAXM];
int main() {
  ios::sync_with_stdio(0);
  s.init();
  t.init();
  x.init();
  unit.init();
  int n, l, m;
  cin >> n >> l >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    s.m[0][a[i] % m]++;
  }
  for (int i = 1; i <= n; ++i) {
    cin >> b[i];
    for (int j = 0; j < m; ++j) x.m[j][(j + b[i]) % m]++;
  }
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    t.m[(m - (c[i] + b[i]) % m) % m][0]++;
  }
  mat ret = s * quickpow(x, l - 2) * t;
  cout << ret.m[0][0] << "\n";
  return 0;
}
