#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
vector<vector<int>> back;
vector<vector<pair<int, int64_t>>> g;
vector<bool> used;
int dfs(int v = 0, int64_t cmin = 1e18) {
  used[v] = true;
  if (v == g.size() - 1) {
    return cmin;
  }
  for (size_t i = 0; i < g[v].size(); i++) {
    if (!used[g[v][i].first] && g[v][i].second) {
      int temp = dfs(g[v][i].first, min(cmin, g[v][i].second));
      if (temp) {
        g[v][i].second -= temp;
        g[g[v][i].first][back[v][i]].second += temp;
        return temp;
      }
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, x, u, v, f;
  cin >> n >> m >> x;
  back.resize(n);
  g.resize(n);
  for (int i = 0; i < m; i++) {
    cin >> u >> v >> f;
    back[--v].emplace_back(g[--u].size());
    back[u].emplace_back(g[v].size());
    g[v].emplace_back(u, 0);
    g[u].emplace_back(v, f);
  }
  double l = 0, r = 1e6;
  for (int i = 0; i < 100; i++) {
    double m = (l + r) / 2;
    vector<vector<pair<int, int64_t>>> gt(n);
    for (int v = 0; v < n; v++) {
      for (auto &u : g[v]) {
        gt[v].emplace_back(u.first, int64_t(double(u.second) / m + EPS));
      }
    }
    swap(gt, g);
    int max_flow = 0, delta = 0;
    do {
      used.assign(n, false);
      delta = dfs();
      max_flow += delta;
      if (max_flow >= x) {
        break;
      }
    } while (delta);
    if (max_flow >= x) {
      l = m;
    } else {
      r = m;
    }
    swap(gt, g);
  }
  cout << fixed << setprecision(15) << double(x * l);
  return 0;
}
