#include <bits/stdc++.h>
using namespace std;
int n, m, t, x;
struct comp {
  double x, y;
  comp(double xx = 0, double yy = 0) { x = xx, y = yy; };
};
comp operator+(comp a, comp b) { return comp(a.x + b.x, a.y + b.y); }
comp operator-(comp a, comp b) { return comp(a.x - b.x, a.y - b.y); }
comp operator*(comp a, comp b) {
  return comp(a.x * b.x - a.y * b.y, a.x * b.y + b.x * a.y);
}
int lim;
int top;
int rev[200010];
const double pi = acos(-1);
void FFT(comp *A, int type) {
  for (int i = 0; i <= lim; ++i) {
    if (i < rev[i]) swap(A[i], A[rev[i]]);
  }
  for (int mid = 1; mid < lim; mid <<= 1) {
    comp wn = comp(cos(pi / mid), type * sin(pi / mid));
    int len = mid * 2;
    for (int i = 0; i < lim; i += len) {
      comp w = comp(1, 0);
      for (int j = 0; j < mid; ++j, w = w * wn) {
        comp x = A[i + j], y = w * A[i + j + mid];
        A[i + j] = x + y;
        A[i + j + mid] = x - y;
      }
    }
  }
  if (type == -1) {
    for (int i = 0; i <= lim; ++i) {
      A[i].x = A[i].x / lim;
    }
  }
}
void pre() {
  lim = 1;
  int tmp = 0;
  while (lim <= 4 * t) lim = lim * 2, tmp++;
  for (int i = 0; i <= lim; ++i) {
    rev[i] = (rev[i >> 1] >> 1 | (i & 1) << (tmp - 1));
  }
}
comp a[200010], b[200010];
void mul(double *A, double *B, double *C) {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  memset(C, 0, sizeof(C));
  for (int i = 0; i < 2 * t; ++i) {
    a[i].x = A[i + 1];
  }
  for (int i = 0; i < t; ++i) {
    b[i].x = B[i + 1];
  }
  FFT(a, 1), FFT(b, 1);
  for (int i = 0; i <= lim; ++i) {
    a[i] = a[i] * b[i];
  }
  FFT(a, -1);
  for (int i = 0; i <= t; ++i) {
    C[i] = a[t + i - 1].x;
  }
}
struct qwq {
  int v;
  double w;
  int nxt;
} edge[200010];
int cnt = -1;
int head[200010];
void add(int u, int v, double w) {
  edge[++cnt].nxt = head[u];
  edge[cnt].v = v;
  edge[cnt].w = w;
  head[u] = cnt;
}
double G[110][110];
void pre_dis() {
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
      }
    }
  }
}
double p[110][40010];
double dp[110][40010];
double now[40010];
bool vis[110];
queue<int> q;
void spfa() {
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= t; ++j) {
      dp[i][j] = 1145e4;
    }
    for (int j = t + 1; j <= 2 * t; ++j) {
      dp[i][j] = G[n][i] + x;
    }
  }
  for (int j = 0; j <= t; ++j) dp[n][j] = 0;
  for (int j = t + 1; j <= 2 * t; ++j) dp[n][j] = x;
  q.push(n);
  vis[n] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    vis[u] = false;
    for (int i = head[u]; ~i; i = edge[i].nxt) {
      int v = edge[i].v;
      mul(dp[u], p[i], now);
      bool changed = false;
      for (int j = 0; j <= t; ++j) {
        if ((now[j] / 100000.0) + edge[i].w < dp[v][j]) {
          dp[v][j] = (now[j] / 100000.0) + edge[i].w;
          changed = true;
        }
      }
      if (changed && !vis[v]) {
        q.push(v);
        vis[v] = true;
      }
    }
  }
}
int main() {
  memset(head, -1, sizeof(head));
  scanf("%d%d%d%d", &n, &m, &t, &x);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      G[i][j] = 1145e4;
    }
  }
  for (int i = 1; i <= m; ++i) {
    int u, v;
    double w;
    scanf("%d%d%lf", &u, &v, &w);
    add(v, u, w);
    G[v][u] = w;
    for (int j = t; j >= 1; --j) {
      scanf("%lf", &p[cnt][j]);
    }
  }
  pre_dis();
  pre();
  spfa();
  printf("%lf\n", dp[1][0]);
}
