#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int mod = 7 + 1e9;
const int N = 103;
int n, L, m;
int bb[1000006], cc;
struct matrix {
  int a[N];
  matrix operator*(const matrix& b) const {
    static matrix ans;
    memset(ans.a, 0, sizeof ans.a);
    for (int i = 0; i < m; ++i)
      for (int j = 0; j < m; ++j)
        ans.a[(i + j) % m] = (ans.a[(i + j) % m] + (ll)a[i] * b.a[j]) % mod;
    return ans;
  }
  matrix operator^(int n) const {
    static matrix ans, q;
    q = *this;
    ans.a[0] = 1;
    while (n) {
      if (n & 1) ans = ans * q;
      q = q * q;
      n >>= 1;
    }
    return ans;
  }
} a, b, c;
int main() {
  scanf("%d%d%d", &n, &L, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &cc);
    ++a.a[cc];
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &cc);
    ++b.a[cc];
    bb[i] = cc;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &cc);
    ++c.a[(bb[i] + cc) % m];
  }
  b = b ^ (L - 2);
  a = a * b * c;
  cout << a.a[0] << endl;
  return 0;
}
