#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long mod = 1e9 + 7;
long long dp[N][105];
long long a[3][1000005];
long long cnt[3][205];
long long n, m, L, ans;
void add(long long &a, long long b) {
  a += b;
  if (a > mod) a -= mod;
}
void solve(long long n) {
  if (n <= 1) return;
  long long mid = n / 2;
  if (n % 2)
    solve(n - 1);
  else
    solve(mid);
  for (long long i = 0; i < m; i++) {
    long long &res = dp[n][i];
    if (n % 2 == 0) {
      for (long long j = 0; j < m; j++) {
        long long k = (i - j + m) % m;
        long long num = dp[mid][j] * dp[mid][k] % mod;
        add(res, num);
      }
    } else {
      for (long long j = 0; j < m; j++) {
        long long k = (i - j + m) % m;
        long long num = (dp[n - 1][j] * dp[1][k]) % mod;
        add(res, num);
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> L >> m;
  L -= 2;
  for (long long i = 0; i <= 2; i++) {
    for (long long j = 1; j <= n; j++) {
      cin >> a[i][j];
      if (a[i][j] == m) a[i][j] = 0;
    }
  }
  for (long long i = 1; i <= n; i++) {
    a[2][i] += a[1][i];
    if (a[2][i] >= m) a[2][i] -= m;
    cnt[0][a[0][i]]++;
    cnt[1][a[1][i]]++;
    cnt[2][a[2][i]]++;
  }
  for (long long i = 0; i < m; i++) {
    dp[1][i] = cnt[1][i];
  }
  solve(L);
  if (L == 0) {
    for (long long i = 0; i < m; i++) {
      long long j = (m - i) % m;
      long long num = cnt[0][i] * cnt[2][j] % mod;
      add(ans, num);
    }
  } else {
    for (long long i = 0; i < m; i++)
      for (long long j = 0; j < m; j++) {
        long long k = (2 * m - i - j) % m;
        long long num = (cnt[0][i] * dp[L][j] % mod) * cnt[2][k] % mod;
        add(ans, num);
      }
  }
  cout << ans;
  return 0;
}
