#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(-1);
const int N = 262144 + 5, M = 110, T = 2e4 + 10;
struct comp {
  double x, y;
  comp() {}
  comp(double a, double b) : x(a), y(b) {}
  comp operator+(const comp &b) const { return comp(x + b.x, y + b.y); }
  comp operator-(const comp &b) const { return comp(x - b.x, y - b.y); }
  comp operator*(const comp &b) const {
    return comp(x * b.x - y * b.y, b.x * y + x * b.y);
  }
  comp conj() { return comp(x, -y); }
} W[N], A[N], B[N];
int rev[N], len;
void init(int n) {
  int k = 0;
  for (len = 1; len <= n; len <<= 1) k++;
  for (int i = 1; i < len; i++)
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (k - 1));
  for (int i = 0; i < len; i++)
    W[i] = comp(cos(pi * i / len), sin(pi * i / len));
}
void fft(comp *a, int ty) {
  for (int i = 1; i < len; i++)
    if (i < rev[i]) swap(a[i], a[rev[i]]);
  static comp t1, t2;
  for (int i = 1; i < len; i <<= 1) {
    for (int j = 0; j < len; j += i << 1) {
      for (int k = j; k < j + i; k++) {
        t1 = a[k], t2 = W[len / (i << 1) * (k - j)] * a[k + i];
        a[k] = t1 + t2;
        a[k + i] = t1 - t2;
      }
    }
  }
  if (ty == -1) {
    reverse(a + 1, a + len);
    for (int i = 0; i < len; i++) a[i].x /= len, a[i].y /= len;
  }
}
struct edge {
  int u, v, w;
  double t[T];
} e[M];
int n, m, t, x;
double f[M][T * 2], g[M][T * 2], dis[M][M];
void cdq(int l, int r) {
  if (l >= t + 1) return;
  if (l == r) {
    for (int i = 1; i <= n - 1; ++i) f[i][l] = 1e18;
    for (int i = 1; i <= m; ++i)
      if (e[i].u != n) {
        f[e[i].u][l] = min(f[e[i].u][l], e[i].w + g[i][l]);
      }
    return;
  }
  int mid = (l + r) >> 1;
  cdq(mid + 1, r);
  init(r - mid + r - l);
  for (int i = 1; i <= m; ++i)
    if (e[i].u != n) {
      int &v = e[i].v;
      A[0] = B[0] = comp(0, 0);
      for (int j = 1; j <= len - 1; ++j)
        A[j] = comp(j <= r - mid ? f[v][mid + j] : 0, 0);
      for (int j = 1; j <= len - 1; ++j)
        B[j] = comp(j <= r - l && j <= t ? e[i].t[j] : 0, 0);
      reverse(B, B + r - l + 1);
      fft(A, 1);
      fft(B, 1);
      for (int j = 0; j <= len - 1; ++j) A[j] = A[j] * B[j];
      fft(A, -1);
      for (int j = l; j <= mid; ++j) {
        g[i][j] += A[j - mid + r - l].x;
      }
    }
  cdq(l, mid);
}
int main() {
  scanf("%d%d%d%d", &n, &m, &t, &x);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) dis[i][j] = i == j ? 0 : 1e18;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &e[i].u, &e[i].v, &e[i].w);
    for (int j = 1; j <= t; ++j) {
      int x;
      scanf("%d", &x);
      e[i].t[j] = x / 1e5;
    }
    dis[e[i].u][e[i].v] = min(dis[e[i].u][e[i].v], (double)e[i].w);
  }
  for (int k = 1; k <= n; ++k)
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j)
        dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
  for (int i = 1; i <= n; ++i)
    for (int j = t + 1; j <= 2 * t; ++j) f[i][j] = x + dis[i][n];
  cdq(0, 2 * t);
  printf("%.10f\n", f[1][0]);
  return 0;
}
