#include <bits/stdc++.h>
using namespace std;
const double pi =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
pair<pair<int, int>, int> t[510];
const int N = 60;
int n;
double cap[N][N];
double flow[N][N];
double edmonds(int s, int t, double k) {
  int b, e, q[N], p[N];
  double d, FLOW = 0;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j) flow[i][j] = 0;
  for (;;) {
    for (int i = 0; i < (n); ++i) p[i] = -1;
    for (q[b = e = 0] = s; b <= e; b++)
      for (int v = 0; v < (n); ++v)
        if (cap[q[b]][v] - flow[q[b]][v] >= k - 0.000000001 && p[v] < 0)
          p[q[++e] = v] = q[b];
    if (p[t] < 0) break;
    d = cap[p[t]][t] - flow[p[t]][t];
    for (int i = t; i != s; i = p[i]) d = min(d, cap[p[i]][i] - flow[p[i]][i]);
    int dv = (d + 0.000000001) / k;
    d = dv * k;
    for (int i = t; i != s; i = p[i]) {
      flow[p[i]][i] += d;
      flow[i][p[i]] -= d;
    }
    FLOW += d;
  }
  return FLOW;
}
double BS(int x, int m, int sum) {
  double p = 0.000000001, k = sum;
  for (int i = 0; i < (100); ++i) {
    memset(cap, 0, sizeof(cap));
    for (int j = 0; j < (m); ++j)
      cap[t[j].first.first][t[j].first.second] = t[j].second;
    double w = (p + k) / 2;
    if (edmonds(0, n - 1, w) >= x * w - 0.000000001)
      p = w;
    else
      k = w;
  }
  return x * p;
}
int main() {
  int m, x, sum = 0;
  scanf("%d%d%d", &n, &m, &x);
  for (int i = 0; i < (m); ++i) {
    scanf("%d%d%d", &t[i].first.first, &t[i].first.second, &t[i].second);
    t[i].first.first--;
    t[i].first.second--;
    sum += t[i].second;
  }
  printf("%.9lf\n", BS(x, m, sum));
  return 0;
}
