#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, l, m;
long long a[3][100], x[100][100], y[100][100], tmp[100][100];
int main() {
  scanf("%i%i%i", &n, &l, &m);
  int c, d[n];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%i", &c);
      if (i == 1) d[j] = c;
      if (i == 2)
        a[i][(c + d[j]) % m]++;
      else
        a[i][c % m]++;
    }
  }
  for (int i = 0; i < m; i++) {
    x[i][i] = 1;
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      y[i][j] = a[1][(i - j + m) % m];
    }
  }
  for (l -= 2; l > 0; l >>= 1) {
    if (l & 1) {
      for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
          tmp[i][j] = 0;
          for (int k = 0; k < m; k++) {
            tmp[i][j] += (x[i][k] * y[k][j]) % mod;
            tmp[i][j] %= mod;
          }
        }
      }
      for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
          x[i][j] = tmp[i][j];
        }
      }
    }
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < m; j++) {
        tmp[i][j] = 0;
        for (int k = 0; k < m; k++) {
          tmp[i][j] += (y[i][k] * y[k][j]) % mod;
          tmp[i][j] %= mod;
        }
      }
    }
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < m; j++) {
        y[i][j] = tmp[i][j];
      }
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      tmp[i][j] = 0;
      for (int k = 0; k < m; k++) {
        tmp[i][j] += (a[0][(i - k + m) % m] * x[k][j]) % mod;
        tmp[i][j] %= mod;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      x[i][j] = tmp[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      tmp[i][j] = 0;
      for (int k = 0; k < m; k++) {
        tmp[i][j] += (x[i][k] * a[2][(k - j + m) % m]) % mod;
        tmp[i][j] %= mod;
      }
    }
  }
  printf("%i", tmp[0][0]);
  return 0;
}
