#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
namespace Input {
const int BUF = 65536;
char buf[BUF];
char *head = buf, *tail = buf;
}  // namespace Input
inline char inputchar() {
  using namespace Input;
  if (head == tail) tail = (head = buf) + fread(buf, 1, BUF, stdin);
  return *head++;
}
inline void inputnum(int &x) {
  char ch = inputchar();
  while (ch > '9' || ch < '0') ch = inputchar();
  x = ch - '0';
  ch = inputchar();
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - '0';
    ch = inputchar();
  }
}
struct Complex {
  double x, y;
  Complex() {}
  Complex(double a, double b) { x = a, y = b; }
  Complex operator+(const Complex &b) const {
    return Complex(x + b.x, y + b.y);
  }
  Complex operator-(const Complex &b) const {
    return Complex(x - b.x, y - b.y);
  }
  Complex operator*(const Complex &b) const {
    return Complex(x * b.x - y * b.y, y * b.x + x * b.y);
  }
  Complex operator/(const double &b) const { return Complex(x / b, y / b); }
} a[160005], b[160005];
int n, m, x, t;
int dis[55][55], u[105], v[105], cost[105];
double p[105][40005];
double f[55][40005], g[105][40005];
inline int rev(int x, int len) {
  int ret = 0;
  for (int i = 1; i <= len; ++i) {
    ret <<= 1;
    ret |= x & 1;
    x >>= 1;
  }
  return ret;
}
inline void FFT(Complex *x, int len, int I) {
  int N = (1 << len), j;
  for (int i = 0; i < N; ++i)
    if ((j = rev(i, len)) > i) swap(x[i], x[j]);
  for (int i = 2; i <= N; i <<= 1) {
    double tot = 2 * pi / i;
    Complex Wn = Complex(cos(tot), I * sin(tot));
    for (int j = 0; j < N; j += i) {
      Complex W = Complex(1, 0);
      for (int k = j; k < j + (i >> 1); ++k) {
        Complex t1 = x[k], t2 = x[k + (i >> 1)] * W;
        x[k] = t1 + t2;
        x[k + (i >> 1)] = t1 - t2;
        W = W * Wn;
      }
    }
  }
}
inline void DFT(Complex *x, int len) { FFT(x, len, 1); }
inline void IDFT(Complex *x, int len) {
  int N = (1 << len);
  FFT(x, len, -1);
  for (int i = 0; i < N; ++i) x[i] = x[i] / N;
}
void push(int l, int r) {
  int mid = l + r >> 1, len = 0, tot;
  tot = r - l + r - mid - 1;
  while ((1 << len) <= tot) len++;
  for (int i = 1; i <= m; ++i) {
    int to = v[i];
    for (int j = 0; j < (1 << len); ++j) a[j] = b[j] = Complex(0, 0);
    for (int j = mid + 1; j <= r; ++j) a[r - j] = Complex(f[to][j], 0);
    for (int j = 0; j <= r - l; ++j) b[j] = Complex(p[i][j], 0);
    DFT(a, len), DFT(b, len);
    for (int j = 0; j < (1 << len); ++j) a[j] = a[j] * b[j];
    IDFT(a, len);
    for (int j = l; j <= mid; ++j) g[i][j] += a[r - j].x;
  }
}
void cdq(int l, int r) {
  if (l == r) {
    for (int i = 1; i <= m; ++i)
      f[u[i]][l] = min(f[u[i]][l], g[i][l] + cost[i]);
    return;
  }
  int mid = l + r >> 1;
  cdq(mid + 1, r);
  push(l, r);
  cdq(l, mid);
}
int main() {
  inputnum(n);
  inputnum(m);
  inputnum(t);
  inputnum(x);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (i != j) dis[i][j] = 1e9;
  for (int i = 1; i <= m; ++i) {
    inputnum(u[i]);
    inputnum(v[i]);
    inputnum(cost[i]);
    dis[u[i]][v[i]] = cost[i];
    int totp;
    for (int j = 1; j <= t; ++j) {
      inputnum(totp);
      p[i][j] = totp / 1e5;
    }
  }
  for (int k = 1; k <= n; ++k)
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j)
        if (dis[i][j] > dis[i][k] + dis[k][j])
          dis[i][j] = dis[i][k] + dis[k][j];
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= t; ++j) f[i][j] = (i == n) ? 0 : 1e9;
    for (int j = t + 1; j <= (t << 1); ++j) f[i][j] = dis[i][n] + x;
  }
  push(0, (t << 1));
  cdq(0, t);
  printf("%.9lf ", f[1][0]);
  return 0;
}
