#include <bits/stdc++.h>
using namespace std;
int n, m, t, k, x;
struct Edge {
  int to, dis, id;
  Edge *next;
};
Edge *E[70010], *E2[70010], Pr[70010 << 1];
int Es;
void addedge(int u, int v, int w, int i) {
  Pr[++Es].to = v;
  Pr[Es].dis = w;
  Pr[Es].id = i;
  Pr[Es].next = E[u];
  E[u] = &Pr[Es];
  Pr[++Es].to = u;
  Pr[Es].dis = w;
  Pr[Es].id = i;
  Pr[Es].next = E2[v];
  E2[v] = &Pr[Es];
}
const double PI = acos(-1);
struct Com {
  double x, y;
  Com(double x = 0, double y = 0) : x(x), y(y) {}
} A[70010], B[70010];
Com operator+(const Com &a, const Com &b) { return Com(a.x + b.x, a.y + b.y); }
Com operator-(const Com &a, const Com &b) { return Com(a.x - b.x, a.y - b.y); }
Com operator*(const Com &a, const Com &b) {
  return Com(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}
void FFT(Com *a, int f, int k) {
  for (int i = 0, j = 0; i < k; i++) {
    if (i > j) swap(a[i], a[j]);
    for (int l = k >> 1; (j ^= l) < l; l >>= 1)
      ;
  }
  for (int i = 1; i < k; i <<= 1) {
    Com w(cos(PI / i), f * sin(PI / i));
    for (int j = 0; j < k; j += (i << 1)) {
      Com e(1, 0);
      for (int k = 0; k < i; k++, e = e * w) {
        Com x, y;
        x = a[j + k];
        y = a[j + k + i] * e;
        a[j + k] = x + y;
        a[j + k + i] = x - y;
      }
    }
  }
  if (f == -1)
    for (int i = 0; i < k; i++) a[i].x /= k;
}
double f[110][70010], g[110][70010];
double Pn[110][70010];
void calc(int l, int M, int r) {
  int N = M - l + 1 + min(t, r - l);
  for (k = 1; k <= N; k <<= 1)
    ;
  for (int u = 1; u <= n; u++) {
    for (Edge *P = E[u]; P; P = P->next)
      for (int i = l; i <= M; i++) f[u][i] = min(f[u][i], g[P->id][i] + P->dis);
    for (int i = 0; i < k; i++) A[i] = Com();
    for (int i = l; i <= M; i++) A[i - l] = Com(f[u][i], 0);
    FFT(A, 1, k);
    for (Edge *P = E2[u]; P; P = P->next) {
      for (int i = 0; i < k; i++) B[i] = Com();
      for (int i = 1; i <= min(t, r - l + 1); i++) B[i] = Com(Pn[P->id][i], 0);
      FFT(B, 1, k);
      for (int i = 0; i < k; i++) B[i] = B[i] * A[i];
      FFT(B, -1, k);
      for (int i = M + 1; i <= r; i++) g[P->id][i] += B[i - l].x;
    }
  }
}
void solve(int l, int r) {
  int M = l + r >> 1;
  if (l == r) {
    for (int i = 1; i <= n; i++)
      for (Edge *P = E[i]; P; P = P->next)
        f[i][l] = min(f[i][l], g[P->id][l] + P->dis);
    return;
  }
  solve(l, M);
  calc(l, M, r);
  solve(M + 1, r);
}
int d[110][110];
void Work() {
  for (int k = 1; k <= n; k++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        d[i][j] = min(1LL * d[i][j], 1LL * d[i][k] + d[k][j]);
  for (int i = 1; i <= n; i++) d[i][i] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= t << 1; j++)
      f[i][j] = i == n ? (j < t ? x : 0) : 0x7f7f7f7f;
  for (int u = 1; u <= n; u++)
    for (Edge *P = E[u]; P; P = P->next)
      for (int j = 0; j < t; j++) g[P->id][j] = d[P->to][n] + x;
  calc(0, t - 1, t << 1);
  solve(t, t << 1);
  printf("%.10lf\n", f[1][t << 1]);
}
void Init() {
  scanf("%d%d%d%d", &n, &m, &t, &x);
  memset(d, 127, sizeof(d));
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    addedge(u, v, w, i);
    d[u][v] = min(d[u][v], w);
    for (int j = 1; j <= t; j++) {
      int x;
      scanf("%d", &x);
      Pn[i][j] = 1e-5 * x;
    }
  }
}
int main() {
  Init();
  Work();
}
