#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = LLONG_MAX;
const long long ninf = LLONG_MIN;
const long double eps = 1e-12;
const long long N = 1000005;
const long long LOGN = log2(N);
struct Edge {
  long long from, to, cap, flow, index;
  Edge(long long from, long long to, long long cap, long long flow,
       long long index)
      : from(from), to(to), cap(cap), flow(flow), index(index) {}
  long long rcap() { return cap - flow; }
};
struct Dinic {
  long long N;
  vector<vector<Edge> > G;
  vector<vector<Edge *> > Lf;
  vector<long long> layer;
  vector<long long> Q;
  Dinic(long long N) : N(N), G(N), Q(N) {}
  void AddEdge(long long from, long long to, long long cap) {
    if (from == to) return;
    G[from].push_back(Edge(from, to, cap, 0, G[to].size()));
    G[to].push_back(Edge(to, from, 0, 0, G[from].size() - 1));
  }
  long long BlockingFlow(long long s, long long t) {
    layer.clear();
    layer.resize(N, -1);
    layer[s] = 0;
    Lf.clear();
    Lf.resize(N);
    long long head = 0, tail = 0;
    Q[tail++] = s;
    while (head < tail) {
      long long x = Q[head++];
      for (long long i = 0; i < G[x].size(); i++) {
        Edge &e = G[x][i];
        if (e.rcap() <= 0) continue;
        if (layer[e.to] == -1) {
          layer[e.to] = layer[e.from] + 1;
          Q[tail++] = e.to;
        }
        if (layer[e.to] > layer[e.from]) {
          Lf[e.from].push_back(&e);
        }
      }
    }
    if (layer[t] == -1) return 0;
    long long totflow = 0;
    vector<Edge *> P;
    while (!Lf[s].empty()) {
      long long curr = P.empty() ? s : P.back()->to;
      if (curr == t) {
        long long amt = P.front()->rcap();
        for (long long i = 0; i < P.size(); ++i) {
          amt = min(amt, P[i]->rcap());
        }
        totflow += amt;
        for (long long i = P.size() - 1; i >= 0; --i) {
          P[i]->flow += amt;
          G[P[i]->to][P[i]->index].flow -= amt;
          if (P[i]->rcap() <= 0) {
            Lf[P[i]->from].pop_back();
            P.resize(i);
          }
        }
      } else if (Lf[curr].empty()) {
        P.pop_back();
        for (long long i = 0; i < N; ++i)
          for (long long j = 0; j < Lf[i].size(); ++j)
            if (Lf[i][j]->to == curr) Lf[i].erase(Lf[i].begin() + j);
      } else {
        P.push_back(Lf[curr].back());
      }
    }
    return totflow;
  }
  long long GetMaxFlow(long long s, long long t) {
    long long totflow = 0;
    while (long long flow = BlockingFlow(s, t)) totflow += flow;
    return totflow;
  }
};
long long n, m;
long long x;
long long a[N], b[N];
long double c[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> x;
  for (int i = 0; i < m; i++) cin >> a[i] >> b[i] >> c[i];
  long double l = 1.0 / x, r = 1e9, ans = 0;
  for (int it = 0; it < 100; it++) {
    Dinic mf(n);
    long double mid = (l + r) * 0.5;
    for (int i = 0; i < m; i++) {
      long long cap = (c[i] / mid);
      mf.AddEdge((a[i] - 1), (b[i] - 1), cap);
    }
    if (mf.GetMaxFlow(0, n - 1) >= x) {
      ans = mid;
      l = mid;
    } else {
      r = mid;
    }
  }
  ans = l * x;
  cout << fixed << setprecision(15);
  cout << ans << "\n";
  return 0;
}
