#include <bits/stdc++.h>
using namespace std;
bool vis[26];
int level[101007], iter[101007], n, x, n1s[550], n2s[550], wss[550];
struct edge {
  long long cap;
  int to, rev;
  edge(int _to, long long _cap, int _rev) : to(_to), cap(_cap), rev(_rev) {}
};
struct dinic {
  vector<edge> graph[101007];
  void vrau() {
    fill(iter, iter + x + 52, 0);
    iter[101007 - 1] = 0;
  }
  void reset() { fill(graph, graph + x + 52, vector<edge>()); }
  void add(int from, int to, long long cap) {
    graph[from].push_back(edge(to, cap, graph[to].size()));
    graph[to].push_back(edge(from, 0, graph[from].size() - 1));
  }
  void bfs(int s) {
    for (int i = 0; i <= x + 51; i++) level[i] = -1;
    level[101007 - 1] = -1;
    queue<int> q;
    level[s] = 0;
    q.push(s);
    while (!q.empty()) {
      int actual = q.front();
      q.pop();
      for (int i = 0; i < graph[actual].size(); i++) {
        edge &e = graph[actual][i];
        if (e.cap > 0 && level[e.to] < 0) {
          level[e.to] = level[actual] + 1;
          q.push(e.to);
        }
      }
    }
  }
  long long dfs(int v, int t, long long f) {
    if (v == t) return f;
    for (int &i = iter[v]; i < graph[v].size(); i++) {
      edge &e = graph[v][i];
      if (e.cap > 0 && level[v] < level[e.to]) {
        long long d = dfs(e.to, t, min(f, e.cap));
        if (d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  long long flow(int start, int to) {
    long long ans = 0;
    while (true) {
      bfs(start);
      if (level[to] < 0) return ans;
      memset(iter, 0, sizeof iter);
      long long f;
      while ((f = dfs(start, to, 1e18 + 7)) > 0) ans += f;
    }
    return ans;
  }
} d[26];
int main() {
  int m, source, sink, n1, n2, w;
  source = 0;
  sink = 101007 - 1;
  scanf("%d %d %d", &n, &m, &x);
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &n1, &n2, &w);
    n1s[i] = n1;
    n2s[i] = n2;
    wss[i] = w;
  }
  int limit = 73;
  long long dae;
  double left, right, mid, flowzao, ans;
  left = 0.0;
  right = 1000000.0;
  while (limit--) {
    mid = (left + right) / 2.0;
    d[limit % 25].vrau();
    if (vis[limit % 25]) d[limit % 25].reset();
    vis[limit % 25] = true;
    for (int i = 0; i < m; i++) {
      d[limit % 25].add(n1s[i], n2s[i], floor(((double)wss[i]) / mid));
    }
    for (int i = 51; i < x + 51; i++) {
      d[limit % 25].add(source, i, 1e18 + 7);
      d[limit % 25].add(i, 1, 1);
    }
    d[limit % 25].add(n, sink, 1e18 + 7);
    flowzao = d[limit % 25].flow(source, sink);
    if (flowzao == ((long long)x)) {
      ans = mid;
      left = mid;
    } else
      right = mid;
  }
  double yo = ans;
  printf("%.17f\n", yo * ((double)x));
  return 0;
}
