#include <bits/stdc++.h>
using namespace std;
vector<int> AdjList[55];
long double f[55][55], auxF[55][55];
int parent[55];
inline bool bfs(int source, int sink, long double val) {
  queue<int> q;
  q.push(source);
  memset(parent, -1, sizeof parent);
  parent[source] = source;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < (int)AdjList[u].size(); i++) {
      int v = AdjList[u][i];
      if (f[u][v] >= val && parent[v] == -1) {
        parent[v] = u;
        q.push(v);
      }
    }
  }
  return parent[sink] != -1;
}
inline long double MaxFlow(int source, int sink, long double val) {
  long double flow = 0;
  while (bfs(source, sink, val)) {
    int v = sink;
    long double garg = 123456789999;
    while (v != source) {
      garg = min(garg, val * ((long long int)(f[parent[v]][v] / val)));
      v = parent[v];
    }
    flow += garg;
    v = sink;
    while (v != source) {
      f[parent[v]][v] -= garg;
      f[v][parent[v]] += garg;
      v = parent[v];
    }
  }
  return flow;
}
long double res;
int n, m, x;
inline bool Func(long double val) {
  for (int i = 0; i < 55; i++)
    for (int j = 0; j < 55; j++) f[i][j] = auxF[i][j];
  f[0][1] = val * x;
  long double aux = MaxFlow(0, n, val);
  if (aux == val * x) {
    res = max(res, aux);
    return true;
  }
  return false;
}
int main() {
  int a, b, c;
  scanf("%d%d%d", &n, &m, &x);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    AdjList[a].push_back(b);
    AdjList[b].push_back(a);
    auxF[a][b] += c;
  }
  AdjList[0].push_back(1);
  AdjList[1].push_back(0);
  long double l = 0, r = 5000010;
  while (r - l >= 0.00000000001) {
    long double mid = (l + r) / 2.0;
    if (Func(mid))
      l = mid;
    else
      r = mid;
  }
  printf("%.6Lf\n", res);
}
