#include <bits/stdc++.h>
using namespace std;
struct node {
  int64_t from;
  int64_t to;
  int64_t w;
  int64_t next;
} e[120000];
int64_t n, m, x, cont, ss, tt;
int64_t divv[2000];
int64_t head[2000];
int64_t cur[2000];
int64_t bian[2000][4];
void add(int64_t from, int64_t to, int64_t w) {
  e[cont].to = to;
  e[cont].w = w;
  e[cont].next = head[from];
  head[from] = cont++;
}
void getmap(double mid) {
  ss = n + 1;
  tt = ss + 1;
  cont = 0;
  memset(head, -1, sizeof(head));
  add(ss, 1, x);
  add(1, ss, 0);
  add(n, tt, x);
  add(tt, n, 0);
  for (int64_t i = 0; i < m; i++) {
    double w = bian[i][2];
    add(bian[i][0], bian[i][1], (int64_t)(w / mid));
    add(bian[i][1], bian[i][0], 0);
  }
}
int64_t makedivv() {
  memset(divv, 0, sizeof(divv));
  divv[ss] = 1;
  queue<int64_t> s;
  s.push(ss);
  while (!s.empty()) {
    int64_t u = s.front();
    if (u == tt) return 1;
    s.pop();
    for (int64_t i = head[u]; i != -1; i = e[i].next) {
      int64_t v = e[i].to;
      int64_t w = e[i].w;
      if (w && divv[v] == 0) {
        divv[v] = divv[u] + 1;
        s.push(v);
      }
    }
  }
  return 0;
}
int64_t Dfs(int64_t u, int64_t maxflow, int64_t tt) {
  if (u == tt) return maxflow;
  int64_t ret = 0;
  for (int64_t &i = cur[u]; i != -1; i = e[i].next) {
    int64_t v = e[i].to;
    int64_t w = e[i].w;
    if (w && divv[v] == divv[u] + 1) {
      int64_t f = Dfs(v, min(maxflow - ret, w), tt);
      e[i].w -= f;
      e[i ^ 1].w += f;
      ret += f;
      if (ret == maxflow) return ret;
    }
  }
  return ret;
}
int64_t Slove(double mid) {
  mid = mid / x;
  getmap(mid);
  int64_t ans = 0;
  while (makedivv() == 1) {
    memcpy(cur, head, sizeof(head));
    ans += Dfs(ss, 0x3f3f3f3f, tt);
  }
  if (ans == x)
    return 1;
  else
    return 0;
}
int main() {
  while (~scanf("%ld%ld%ld", &n, &m, &x)) {
    for (int64_t i = 0; i < m; i++)
      scanf("%ld%ld%ld", &bian[i][0], &bian[i][1], &bian[i][2]);
    double mid, l = 0, r = 10000000000;
    while (r - l >= 1e-8) {
      mid = (l + r) / 2;
      if (Slove(mid) == 1)
        l = mid;
      else
        r = mid;
    }
    printf("%lf\n", l);
  }
}
