#include <bits/stdc++.h>
using i64 = long long;
template <class T>
struct weighted_edge {
  int to;
  T weight;
};
template <class T>
struct weighted_directed_graph
    : public std::vector<std::vector<weighted_edge<T>>> {
  weighted_directed_graph(int n)
      : std::vector<std::vector<weighted_edge<T>>>(n) {}
  void add_edge(int u, int v, T w) { (*this)[u].push_back({v, w}); }
};
template <class T>
T max_flow(const weighted_directed_graph<T>& G, int s, int t) {
  std::vector<std::vector<T>> capacity(G.size(), std::vector<T>(G.size()));
  for (size_t i = 0; i < G.size(); i++) {
    for (auto [j, cap] : G[i]) {
      capacity[i][j] += cap;
    }
  }
  auto augment = [&]() {
    std::queue<std::pair<int, T>> q({{s, std::numeric_limits<T>::max()}});
    std::vector<int> prv(G.size(), -1);
    while (!q.empty()) {
      auto [i, flow] = q.front();
      q.pop();
      if (i == t) {
        for (; i != s; i = prv[i]) {
          capacity[prv[i]][i] -= flow;
          capacity[i][prv[i]] += flow;
        }
        return flow;
      }
      for (size_t j = 0; j < G.size(); j++)
        if (prv[j] == -1) {
          if (T cap = std::min(flow, capacity[i][j]); cap > 0) {
            q.emplace(j, cap);
            prv[j] = i;
          }
        }
    }
    return T(0);
  };
  T total_flow = 0;
  while (T flow = augment()) {
    total_flow += flow;
  }
  return total_flow;
}
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
  int n, m, x;
  std::cin >> n >> m >> x;
  std::vector<std::array<int, 3>> abc(m);
  for (auto& [a, b, c] : abc) {
    std::cin >> a >> b >> c;
    a--;
    b--;
  }
  double lo = 0, hi = 1e6 * n / x;
  while (std::abs(x * lo - x * hi) * 1e9 > std::max(1.0, x * hi)) {
    double mid = (lo + hi) / 2;
    weighted_directed_graph<i64> G(n);
    for (auto [a, b, c] : abc) {
      G.add_edge(a, b, i64(c / mid));
    }
    if (max_flow(G, 0, n - 1) >= x) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  std::cout << std::setprecision(20) << std::fixed << x * (lo + hi) / 2 << '\n';
}
