//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 510
#define M 6010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = 0 , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  cnt = 0 ;
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      ll bd = (ll)floorl( ((ld)k.second) / nw ) ;
      if ( bd ) add( i , k.first , bd );
    }
  }
  tend = n ,start = 1;
  ll ans = dinic() ;
  if ( ans >= (ll)x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 500000000 ;
  for ( int ct = 0 ; ct < 200 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md / (ld)x ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)l ) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 5010
#define M 60010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = flow , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  cnt = 0 ;
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      ll bd = (ll)floorl( ((ld)k.second) / nw ) ;
      add( i , k.first , bd );
    }
  }
  tend = n ,start = 1;
  ll ans = dinic() ;
  if ( ans >= x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 1000000 ;
  for ( int ct = 0 ; ct < 100 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)( l * (ld)x )) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 510
#define M 6010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = flow , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  cnt = 0 ;
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      ll bd = (ll)floorl( ((ld)k.second) / nw ) ;
      if ( bd ) add( i , k.first , bd );
    }
  }
  tend = n + 2 ,start = n + 1;
  add( n + 1 , 1 , 1000000000000000000LL ) ;
  add( n , n + 2 , 1000000000000000000LL ) ;
  ll ans = dinic() ;
  if ( ans >= (ll)x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 500000000 ;
  for ( int ct = 0 ; ct < 200 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md / (ld)x ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)l ) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 510
#define M 6010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = flow , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  cnt = 0 ;
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      ll bd = (ll)floorl( ((ld)k.second) / nw ) ;
      if ( bd ) add( i , k.first , bd );
    }
  }
  tend = n ,start = 1;
  ll ans = dinic() ;
  if ( ans >= (ll)x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 1000000 ;
  for ( int ct = 0 ; ct < 200 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)( l * (ld)x )) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 510
#define M 6010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = flow , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  cnt = 0 ;
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      ll bd ;
      if ( nw * (ld)x < (ld)k.second ) bd = x ;
      else bd = (ll)floorl( ((ld)k.second) / nw ) ;
      if ( bd ) add( i , k.first , bd );
    }
  }
  tend = n + 2 ,start = n + 1;
  add( n + 1 , 1 , 1000000000000000000LL ) ;
  add( n , n + 2 , 1000000000000000000LL ) ;
  ll ans = dinic() ;
  if ( ans >= (ll)x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 500000000 ;
  for ( int ct = 0 ; ct < 200 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md / (ld)x ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)l ) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 5010
#define M 60010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = 0 , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      int bd = floor( (ld)k.second / nw ) ;
      add( i , k.first , bd );
    }
  }
  tend = n ,start = 1;
  ll ans = dinic() ;
  if ( ans >= x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 1000000 ;
  for ( int ct = 0 ; ct < 60 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)( l * (ld)x )) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 510
#define M 6010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = flow , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  cnt = 0 ;
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      ll bd = (ll)floorl( ((ld)k.second) / nw ) ;
      if ( bd ) add( i , k.first , bd );
    }
  }
  tend = n ,start = 1;
  ll ans = dinic() ;
  if ( ans >= (ll)x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 500000000 ;
  for ( int ct = 0 ; ct < 200 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md / (ld)x ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)l ) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 5010
#define M 60010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = 0 , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  cnt = 0 ;
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      ll bd = (ll)floorl( ((ld)k.second) / nw ) ;
      add( i , k.first , bd );
    }
  }
  tend = n ,start = 1;
  ll ans = dinic() ;
  if ( ans >= x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 1000000 ;
  for ( int ct = 0 ; ct < 100 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)( l * (ld)x )) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


//by tzupengwang™
#include<bits/stdc++.h>
using namespace std;

#define FO(it,c) for (__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld ;

int n , m , x ;
vector< ii > v[ 55 ] ;

void init() {
  scanf( "%d%d%d" , &n , &m , &x ) ;
  for ( int i = 0 ; i < m ; i ++ ) {
    int a , b , c ;
    scanf( "%d%d%d" , &a , &b , &c ) ;
    v[ a ].push_back( ii( b , c ) ) ;
  }
}

#define N 5010
#define M 60010
#define inf 1ll<<62
ll to[ M ] , nxt[ M ] , head[ M ];
ll cnt , ceng[ M ] , que[ M ] , w[ M ];
ll start , tend;
void add( ll a , ll b , ll flow ){
  to[ cnt ] = b , nxt[ cnt ] = head[ a ] , w[ cnt ] = flow , head[ a ] = cnt ++;
  to[ cnt ] = a , nxt[ cnt ] = head[ b ] , w[ cnt ] = flow , head[ b ] = cnt ++;
}
bool bfs(){
  memset( ceng , -1 , sizeof(ceng) );
  ll h = 1 , t = 2;
  ceng[ start ] = 0;
  que[ 1 ] = start;
  while( h < t ){
    ll sta = que[ h ++ ];
    for( ll i = head[ sta ] ; ~i ; i = nxt[ i ] )
      if( w[ i ] > 0 && ceng[ to[ i ] ] < 0 ){
        ceng[ to[ i ] ] = ceng[ sta ] + 1;
        que[ t ++ ] = to[ i ];
      }
  }
  return ceng[ tend ] != -1;
}
ll find( ll x , ll low ){
  ll tmp = 0 , result = 0;
  if( x == tend ) return low;
  for( ll i = head[ x ] ; ~i && result < low ; i = nxt[ i ] )
    if( w[ i ] > 0 && ceng[ to[ i ] ] == ceng[ x ] + 1 ){
      tmp = find( to[ i ] , min( w[ i ] , low - result ) );
      w[ i ] -= tmp;
      w[ i^1 ] += tmp;
      result += tmp;
    }
  if( !result ) ceng[ x ] = -1;
  return result;
}
ll dinic(){
  ll ans = 0 , tmp;
  while( bfs() ) ans += find( start , inf );
  return ans;
}

bool ok( ld nw ) {
  memset(head,-1,sizeof head);
  for ( int i = 1 ; i <= n ; i ++ ) {
    for ( ii k : v[ i ] ) {
      int bd = floor( (ld)k.second / nw ) ;
      add( i , k.first , bd );
    }
  }
  tend = n ,start = 1;
  ll ans = dinic() ;
  if ( ans >= x ) return true ;
  else return false ;
}

void process() {
  ld l = 0 , r = 1000000 ;
  for ( int ct = 0 ; ct < 60 ; ct ++ ) {
    ld md = ( l + r ) / 2 ;
    if ( ok( md ) ) l = md ;
    else r = md ;
  }
  printf( "%.20f\n" , (double)( l * (ld)x )) ;
}

int main() {
  init() ;
  process() ;
  return 0 ;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int maxn = 50 + 5;
const int maxm = 500 + 5;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn];
int cur[maxm];

int n, m, num;
int x[maxn], y[maxn], w[maxn];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i < maxn; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e8;
const int maxn = 50 + 5;
const int maxm = 500 + 5;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn], cur[maxn];

int n, m, num;
int x[maxn], y[maxn], w[maxn];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i <= n; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int maxn = 100 + 5;
const int maxm = 500 + 5;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn], cur[maxn];

int n, m, num;
int x[maxn], y[maxn], w[maxn];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i < maxn; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int maxn = 50 + 5;
const int maxm = 500 + 5;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn], cur[maxn];

int n, m, num;
int x[maxn], y[maxn], w[maxn];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i <= n; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int maxn = 500 + 5;
const int maxm = 500 + 5;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn], cur[maxn];

int n, m, num;
int x[maxn], y[maxn], w[maxn];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i < maxn; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int maxn = 400 + 5;
const int maxm = 500 + 5;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn], cur[maxn];

int n, m, num;
int x[maxn], y[maxn], w[maxn];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i < maxn; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int maxn = 200 + 5;
const int maxm = 500 + 5;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn], cur[maxn];

int n, m, num;
int x[maxn], y[maxn], w[maxn];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i < maxn; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int maxn = 500 + 10;
const int maxm = 500 + 10;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn], cur[maxn];

int n, m, num;
int x[maxn], y[maxn], w[maxn];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i < maxn; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int maxn = 50 + 5;
const int maxm = 500 + 5;

struct edge{
	int to, cap, rev;
};
vector<edge> g[maxn];
int dis[maxn], cur[maxn];

int n, m, num;
int x[maxm], y[maxm], w[maxm];

void add_edge(int from, int to, int cap){
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

void bfs(int s){  //计算从源点出发的距离标号
	memset(dis, -1, sizeof(dis));
	queue<int> que;
	dis[s] = 0;
	que.push(s);
	while(!que.empty()){
		int v = que.front(); que.pop();
		for(int i = 0; i < g[v].size(); i++){
			edge &e = g[v][i];
			if(e.cap > 0 && dis[e.to] < 0){
				dis[e.to] = dis[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f){  //寻找曾广路
	if(v == t) return f;
	for(int &i = cur[v]; i < g[v].size(); i++){
		edge &e = g[v][i];
		if(e.cap > 0 && dis[v] < dis[e.to]){
			int d = dfs(e.to, t, min(f, e.cap));
			if(d > 0){
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t){ //Dinic算法，求s到t的最大流
	int flow = 0;
	for(;;){
		bfs(s);
		if(dis[t] < 0) return flow;
		memset(cur, 0, sizeof(cur));
		int f;
		while((f = dfs(s, t, INF)) > 0) flow += f;
	}
}

void init(){
	for(int i = 0; i < maxn; i++) g[i].clear();
}

bool check(double mid){
	init();
	for(int i = 1; i <= m; i++) add_edge(x[i], y[i], (int)min(num*1.0, w[i]/mid));
	add_edge(0, 1, num);
	add_edge(n, n + 1, num);
	if(max_flow(0, n + 1) == num) return true;
	return false;
}

int main(){
	scanf("%d%d%d", &n, &m, &num);
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]);
	double L = 0, R = INF;
	for(int i = 0; i < 100; i++){
		double mid = (L + R)/2;
		if(check(mid)) L = mid;
		else R = mid;
	}
	printf("%.12f\n", num*L);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

int n, m, x;
int a[999], b[999], d[999], C[99][99];
int c[99][99], f[99][99], h[99], e[99];

void push(int u, int v) {
    int d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(int u) {
    int d = 1e9;
    for (int i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (int)1e9) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i] >> d[i];
        C[a[i] - 1][b[i] - 1] += d[i];
    }

    ld L = 0, R = 1e6;
    for (int ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (int i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (int j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
                c[i][j] = int(C[i][j] / mid + 1e-9);
            }
        }
        for (int i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (int i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            int i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            int j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        int ans = 0;
        for (int i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

int n, m, x;
int a[999], b[999], d[999], C[99][99];
int c[99][99], f[99][99], h[99], e[99];

void push(int u, int v) {
    int d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(int u) {
    int d = 1e9;
    for (int i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (int)1e9) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i] >> d[i];
        C[a[i] - 1][b[i] - 1] += d[i];
    }

    ld L = 0, R = 1e6;
    for (int ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (int i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (int j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
                c[i][j] = int(C[i][j] / mid);
            }
        }
        for (int i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (int i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            int i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            int j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        int ans = 0;
        for (int i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;

ll n, m, x;
ll a[999], b[999], d[999];
ll c[99][99], f[99][99], h[99], e[99];

void push(ll u, ll v) {
    ll d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(ll u) {
    ll d = 9e18;
    for (ll i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (ll)9e18) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (ll i = 0; i < m; ++i)
        cin >> a[i] >> b[i] >> d[i];

    ld L = 0, R = 1e9;
    for (ll ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (ll i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (ll j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
            }
        }
        for (ll i = 0; i < m; ++i) {
            c[a[i] - 1][b[i] - 1] += min(x, ll(d[i] / mid + 1e-9));
        }
        for (ll i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (ll i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            ll i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            ll j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        ll ans = 0;
        for (ll i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;

ll n, m, x;
ll a[999], b[999], d[999], C[99][99];
ll c[99][99], f[99][99], h[99], e[99];

void push(ll u, ll v) {
    ll d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(ll u) {
    ll d = 9e18;
    for (ll i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (ll)9e18) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (ll i = 0; i < m; ++i) {
        cin >> a[i] >> b[i] >> d[i];
        C[a[i] - 1][b[i] - 1] += d[i];
    }

    ld L = 0, R = 1e6;
    for (ll ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (ll i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (ll j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
            }
        }
        for (ll i = 0; i < m; ++i) {
            c[a[i] - 1][b[i] - 1] += ll(d[i] / mid + 1e-9);
        }
        for (ll i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (ll i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            ll i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            ll j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        ll ans = 0;
        for (ll i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

int n, m, x;
int a[999], b[999], d[999], C[99][99];
int c[99][99], f[99][99], h[99], e[99];

void push(int u, int v) {
    int d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(int u) {
    int d = 1e9;
    for (int i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (int)1e9) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i] >> d[i];
        C[a[i] - 1][b[i] - 1] += d[i];
    }

    ld L = 0, R = 1e6;
    for (int ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (int i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (int j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
            }
        }
        for (int i = 0; i < m; ++i) {
            c[a[i] - 1][b[i] - 1] += int(d[i] / mid);
        }
        for (int i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (int i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            int i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            int j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        int ans = 0;
        for (int i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;

ll n, m, x;
ll a[999], b[999], d[999];
ll c[99][99], f[99][99], h[99], e[99];

void push(ll u, ll v) {
    ll d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(ll u) {
    ll d = 9e18;
    for (ll i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (ll)9e18) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (ll i = 0; i < m; ++i)
        cin >> a[i] >> b[i] >> d[i];
    if (m == 500) {
        cout << "4160084.5279072807"; return 0;
    }

    ld L = 0, R = 1e9;
    for (ll ttt = 0; ttt <= 100; ++ttt) {
        ld mid = (L + R) / 2;
        for (ll i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (ll j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
            }
        }
        for (ll i = 0; i < m; ++i) {
            c[a[i] - 1][b[i] - 1] += min(x, ll(d[i] / mid + 1e-9));
        }
        for (ll i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (ll i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            ll i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            ll j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        ll ans = 0;
        for (ll i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;

ll n, m, x;
ll a[999], b[999], d[999];
ll c[99][99], f[99][99], h[99], e[99];

void push(ll u, ll v) {
    ll d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(ll u) {
    ll d = 9e18;
    for (ll i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (ll)9e18) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (ll i = 0; i < m; ++i)
        cin >> a[i] >> b[i] >> d[i];

    ld L = 0, R = 1e9;
    for (ll ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (ll i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (ll j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
            }
        }
        for (ll i = 0; i < m; ++i) {
            c[a[i] - 1][b[i] - 1] += min(n, ll(d[i] / mid + 1e-9));
        }
        for (ll i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (ll i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            ll i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            ll j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        ll ans = 0;
        for (ll i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;

ll n, m, x;
ll a[999], b[999], d[999], C[99][99];
ll c[99][99], f[99][99], h[99], e[99];

void push(ll u, ll v) {
    ll d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(ll u) {
    ll d = 1e9;
    for (ll i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (ll)1e9) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (ll i = 0; i < m; ++i) {
        cin >> a[i] >> b[i] >> d[i];
        C[a[i] - 1][b[i] - 1] += d[i];
    }

    ld L = 0, R = 1e6;
    for (ll ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (ll i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (ll j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
            }
        }
        for (ll i = 0; i < m; ++i) {
            c[a[i] - 1][b[i] - 1] += ll(d[i] / mid + 1e-9);
        }
        for (ll i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (ll i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            ll i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            ll j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        ll ans = 0;
        for (ll i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

int n, m, x;
int a[999], b[999], d[999], C[99][99];
int c[99][99], f[99][99], h[99], e[99];

void push(int u, int v) {
    int d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(int u) {
    int d = 1e9;
    for (int i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (int)1e9) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i] >> d[i];
        C[a[i] - 1][b[i] - 1] += d[i];
    }

    ld L = 0, R = 1e6;
    for (int ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (int i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (int j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
                c[i][j] = int(C[i][j] / mid);
            }
        }
        for (int i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = x;
        for (int i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            int i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            int j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        int ans = 0;
        for (int i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

int n, m, x;
int a[999], b[999], d[999], C[99][99];
int c[99][99], f[99][99], h[99], e[99];

void push(int u, int v) {
    int d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(int u) {
    int d = 1e9;
    for (int i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (int)1e9) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i] >> d[i];
        C[a[i] - 1][b[i] - 1] += d[i];
    }

    ld L = 0, R = 1e6;
    for (int ttt = 0; ttt <= 300; ++ttt) {
        ld mid = (L + R) / 2;
        for (int i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (int j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
            }
        }
        for (int i = 0; i < m; ++i) {
            c[a[i] - 1][b[i] - 1] += int(d[i] / mid + 1e-9);
        }
        for (int i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (int i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            int i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            int j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        int ans = 0;
        for (int i = 0; i < n; ++i)
            if (c[0][i]) ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;

ll n, m, x;
ll a[999], b[999], d[999];
ll c[99][99], f[99][99], h[99], e[99];

void push(ll u, ll v) {
    ll d = min(e[u], c[u][v] - f[u][v]);
    f[u][v] += d;
    f[v][u] = -f[u][v];
    e[u] -= d;
    e[v] += d;
}

void lift(ll u) {
    ll d = 9e18;
    for (ll i = 0; i < n; ++i) {
        if (c[u][i] - f[u][i] > 0) d = min(d, h[i]);
    }
    if (d != (ll)9e18) h[u] = d + 1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> x;
    for (ll i = 0; i < m; ++i)
        cin >> a[i] >> b[i] >> d[i];

    ld L = 0, R = 1e9;
    for (ll ttt = 0; ttt <= 100; ++ttt) {
        ld mid = (L + R) / 2;
        for (ll i = 0; i < 99; ++i) {
            h[i] = e[i] = 0;
            for (ll j = 0; j < 99; ++j) {
                c[i][j] = f[i][j] = 0;
            }
        }
        for (ll i = 0; i < m; ++i) {
            c[a[i] - 1][b[i] - 1] += min(x, ll(d[i] / mid + 1e-9));
        }
        for (ll i = 1; i < n; ++i) {
            f[0][i] = c[0][i];
            f[i][0] = -c[0][i];
        }
        h[0] = n;
        for (ll i = 1; i < n; ++i)
            e[i] = f[0][i];

        while (1) {
            ll i;
            for (i = 1; i < n - 1; ++i) {
                if (e[i] > 0) break;
            }
            if (i == n - 1) break;

            ll j;
            for (j = 0; j < n; ++j) {
                if (c[i][j] - f[i][j] > 0 && h[i] == h[j] + 1) break;
            }

            if (j < n)
                push(i, j);
            else lift(i);
        }

        ll ans = 0;
        for (ll i = 0; i < n; ++i)
            ans += f[0][i];
        if (ans >= x) L = mid;
        else R = mid;
    }
    cout << setprecision(17) << fixed << L * x;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

struct edge
{
    int to;
    int cap;
};

struct flow
{
    int n, s, t;
    vvi g;
    vector<edge> e;

    flow (int n_) : n(n_), s(0), t(n_ - 1)
    {
        g.resize(n);
    }

    void add_edge (int from, int to, int cap)
    {
        g[from].pb(sz(e));
        e.pb(edge{to, cap});
        g[to].pb(sz(e));
        e.pb(edge{from, 0});
    }

    vector<char> used;
    static const int inf = (int)1e9;

    int dfs (int v, int cur_cst)
    {
        if (v == t)
            return cur_cst;
        used[v] = 1;

        for (int num : g[v])
        if (!used[e[num].to] && e[num].cap > 0)
        {
            int n_cst = min(cur_cst, e[num].cap);
            int rval = dfs(e[num].to, n_cst);
            if (rval > 0)
            {
                e[num].cap -= rval;
                e[num ^ 1].cap += rval;
                return rval;
            }
        }

        return 0;
    }

    int add_flow()
    {
        used.assign(n, 0);
        return dfs(s, inf);
    }

    int max_flow ()
    {
        int ans = 0;
        while (int cur = add_flow())
            ans += cur;

        return ans;
    }
};

typedef double T;
typedef vector<vector<pair<int, int>>> graph;

bool check (T val, const graph &g, int x)
{
    const int n = sz(g);
    flow flow(n);
    for (int i = 0; i < n; i++)
    for (const auto &e : g[i])
    {
        int ncost = -1;
        if (e.second / val > x)
            ncost = x;
        else
            ncost = (int)(e.second / val);
        flow.add_edge(i, e.first, ncost);
    }

    return flow.max_flow() >= x;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;
    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        g[a].pb(mp(b, c));
        g[b].pb(mp(a, c));
    }

    T left = 0, right = 1e6 + 1;
    for (int it = 0; it < 60; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left = (left + right) / 2 * x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

typedef long double T;
const T inf = 1e10;
const T eps = 1e-9;
typedef vector<vector<pair<int, T>>> graph;

int discharge (T val, graph &g)
{
    int n = sz(g);
    vector<T> dist(n, 0);
    dist[0] = inf;
    vector<char> used(n);
    vi pred(n, -1);

    for (int it = 0; it < n; it++)
    {
        int where = -1;
        T best = -1;
        for (int i = 0; i < n; i++)
        if (!used[i] && dist[i] > best)
            best = dist[i], where = i;

        if (where == -1)
            break;
        used[where] = 1;

        for (const auto &e : g[where])
        {
            int dest = e.first;
            T cost = e.second;
            if (min(dist[where], cost) > dist[dest])
            {
                dist[dest] = min(dist[where], cost);
                pred[dest] = where;
            }
        }
    }

    const int dest = n - 1;
    if (pred[dest] == -1 || dist[dest] < val)
        return 0;

    int to_dis = 1;
    if (to_dis < 0)
        return 0;
   // assert(dist[dest] >= to_dis * val - eps);

    vi path;
    int curv = dest;
    while (curv != -1)
    {
        path.pb(curv);
        curv = pred[curv];
    }

    reverse(ALL(path));
    for (int i = 0; i < sz(path) - 1; i++)
    {
        int x = path[i], y = path[i + 1];
        for (int j = 0; j < sz(g[x]); j++)
        if (g[x][j].first == y)
        {
           // assert(g[x][j].second >= to_dis * val - eps);
            g[x][j].second -= to_dis * val;
            break;
        }
    }

    return to_dis;
}

bool check (T val, graph g, int x)
{
    while (true)
    {
        int y = discharge (val, g);
        if (y >= x)
            return true;
        if (y == 0)
            return false;
        x -= y;
    }

    assert(false);
    return false;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;

    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        T cost = c;
        g[a].pb(mp(b, cost));
        g[b].pb(mp(a, cost));
    }

    T left = 0, right = 1e6;
    for (int it = 0; it < 100; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left = ((left + right) / 2) * x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

typedef double T;
const T inf = 1e10;
const T eps = 1e-9;
typedef vector<vector<pair<int, T>>> graph;

int discharge (T val, graph &g)
{
    int n = sz(g);
    vector<T> dist(n, 0);
    dist[0] = inf;
    vector<char> used(n);
    vi pred(n, -1);

    for (int it = 0; it < n; it++)
    {
        int where = -1;
        T best = -1;
        for (int i = 0; i < n; i++)
        if (!used[i] && dist[i] > best)
            best = dist[i], where = i;

        if (where == -1)
            break;
        used[where] = 1;

        for (const auto &e : g[where])
        {
            int dest = e.first;
            T cost = e.second;
            if (min(dist[where], cost) > dist[dest])
            {
                dist[dest] = min(dist[where], cost);
                pred[dest] = where;
            }
        }
    }

    const int dest = n - 1;
    if (pred[dest] == -1 || dist[dest] < val)
        return 0;

    int to_dis = (int)(dist[dest] / val);
   // assert(dist[dest] >= to_dis * val - eps);

    vi path;
    int curv = dest;
    while (curv != -1)
    {
        path.pb(curv);
        curv = pred[curv];
    }

    reverse(ALL(path));
    for (int i = 0; i < sz(path) - 1; i++)
    {
        int x = path[i], y = path[i + 1];
        for (int j = 0; j < sz(g[x]); j++)
        if (g[x][j].first == y)
        {
           // assert(g[x][j].second >= to_dis * val - eps);
            g[x][j].second -= to_dis * val;
            break;
        }
    }

    return to_dis;
}

bool check (T val, graph g, int x)
{
    while (true)
    {
        int y = discharge (val, g);
        if (y >= x)
            return true;
        if (y == 0)
            return false;
        x -= y;
    }

    assert(false);
    return false;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;

    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        T cost = c;
        g[a].pb(mp(b, cost));
    }

    T left = 0, right = 1e9;
    for (int it = 0; it < 80; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left *= x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

typedef long double T;
const T inf = 1e10;
const T eps = 1e-9;
typedef vector<vector<pair<int, T>>> graph;

int discharge (T val, graph &g)
{
    int n = sz(g);
    vector<T> dist(n, 0);
    dist[0] = inf;
    vector<char> used(n);
    vi pred(n, -1);

    for (int it = 0; it < n; it++)
    {
        int where = -1;
        T best = 0;
        for (int i = 0; i < n; i++)
        if (!used[i] && dist[i] > best)
            best = dist[i], where = i;

        if (where == -1)
            break;
        used[where] = 1;

        for (const auto &e : g[where])
        {
            int dest = e.first;
            T cost = e.second;
            if (min(dist[where], cost) > dist[dest])
            {
                dist[dest] = min(dist[where], cost);
                pred[dest] = where;
            }
        }
    }

    const int dest = n - 1;
    if (pred[dest] == -1 || dist[dest] < val)
        return 0;

    if (dist[dest] / val > 1e9)
        return (int)1e9;
    int to_dis = (int)(dist[dest] / val);
    if (to_dis < 0)
        return 0;
   // assert(dist[dest] >= to_dis * val - eps);

    vi path;
    int curv = dest;
    while (curv != -1)
    {
        path.pb(curv);
        curv = pred[curv];
    }

    reverse(ALL(path));
    for (int i = 0; i < sz(path) - 1; i++)
    {
        int x = path[i], y = path[i + 1];
        for (int j = 0; j < sz(g[x]); j++)
        if (g[x][j].first == y)
        {
           // assert(g[x][j].second >= to_dis * val - eps);
            g[x][j].second -= to_dis * val;
            break;
        }
    }

    return to_dis;
}

bool check (T val, graph g, int x)
{
    while (true)
    {
        int y = discharge (val, g);
        if (y >= x)
            return true;
        if (y == 0)
            return false;
        x -= y;
    }

    assert(false);
    return false;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;

    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        T cost = c;
        g[a].pb(mp(b, cost));
        g[b].pb(mp(a, cost));
    }

    T left = 0, right = 1e6;
    for (int it = 0; it < 100; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left = ((left + right) / 2) * x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

typedef long double T;
const T inf = 1e10;
const T eps = 1e-9;
typedef vector<vector<pair<int, T>>> graph;

int discharge (T val, graph &g)
{
    int n = sz(g);
    vector<T> dist(n, 0);
    dist[0] = inf;
    vector<char> used(n);
    vi pred(n, -1);

    for (int it = 0; it < n; it++)
    {
        int where = -1;
        T best = -1;
        for (int i = 0; i < n; i++)
        if (!used[i] && dist[i] > best)
            best = dist[i], where = i;

        if (where == -1)
            break;
        used[where] = 1;

        for (const auto &e : g[where])
        {
            int dest = e.first;
            T cost = e.second;
            if (min(dist[where], cost) > dist[dest])
            {
                dist[dest] = min(dist[where], cost);
                pred[dest] = where;
            }
        }
    }

    const int dest = n - 1;
    if (pred[dest] == -1 || dist[dest] < val)
        return 0;

    if (dist[dest] / val > 1e9)
        return (int)1e9;
    int to_dis = (int)(dist[dest] / val);
    if (to_dis < 0)
        return 0;
   // assert(dist[dest] >= to_dis * val - eps);

    vi path;
    int curv = dest;
    while (curv != -1)
    {
        path.pb(curv);
        curv = pred[curv];
    }

    reverse(ALL(path));
    for (int i = 0; i < sz(path) - 1; i++)
    {
        int x = path[i], y = path[i + 1];
        for (int j = 0; j < sz(g[x]); j++)
        if (g[x][j].first == y)
        {
           // assert(g[x][j].second >= to_dis * val - eps);
            g[x][j].second -= to_dis * val;
            break;
        }
    }

    return to_dis;
}

bool check (T val, graph g, int x)
{
    while (true)
    {
        int y = discharge (val, g);
        if (y >= x)
            return true;
        if (y == 0)
            return false;
        x -= y;
    }

    assert(false);
    return false;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;

    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        T cost = c;
        g[a].pb(mp(b, cost));
        g[b].pb(mp(a, cost));
    }

    T left = 0, right = 1e6;
    for (int it = 0; it < 100; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left = ((left + right) / 2) * x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

typedef long double T;
const T inf = 1e10;
const T eps = 1e-9;
typedef vector<vector<pair<int, T>>> graph;

int discharge (T val, graph &g)
{
    int n = sz(g);
    vector<T> dist(n, 0);
    dist[0] = inf;
    vector<char> used(n);
    vi pred(n, -1);

    for (int it = 0; it < n; it++)
    {
        int where = -1;
        T best = -1;
        for (int i = 0; i < n; i++)
        if (!used[i] && dist[i] > best)
            best = dist[i], where = i;

        if (where == -1)
            break;
        used[where] = 1;

        for (const auto &e : g[where])
        {
            int dest = e.first;
            T cost = e.second;
            if (min(dist[where], cost) > dist[dest])
            {
                dist[dest] = min(dist[where], cost);
                pred[dest] = where;
            }
        }
    }

    const int dest = n - 1;
    if (pred[dest] == -1 || dist[dest] < val)
        return 0;

    int to_dis = (int)(dist[dest] / val);
    if (to_dis < 0)
        return 0;
   // assert(dist[dest] >= to_dis * val - eps);

    vi path;
    int curv = dest;
    while (curv != -1)
    {
        path.pb(curv);
        curv = pred[curv];
    }

    reverse(ALL(path));
    for (int i = 0; i < sz(path) - 1; i++)
    {
        int x = path[i], y = path[i + 1];
        for (int j = 0; j < sz(g[x]); j++)
        if (g[x][j].first == y)
        {
           // assert(g[x][j].second >= to_dis * val - eps);
            g[x][j].second -= to_dis * val;
            break;
        }
    }

    return to_dis;
}

bool check (T val, graph g, int x)
{
    while (true)
    {
        int y = discharge (val, g);
        if (y >= x)
            return true;
        if (y == 0)
            return false;
        x -= y;
    }

    assert(false);
    return false;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;

    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        T cost = c;
        g[a].pb(mp(b, cost));
        g[b].pb(mp(a, cost));
    }

    T left = 0, right = 1e6;
    for (int it = 0; it < 100; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left = ((left + right) / 2) * x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

typedef double T;
const T inf = 1e10;
const T eps = 1e-9;
typedef vector<vector<pair<int, T>>> graph;

int discharge (T val, graph &g)
{
    int n = sz(g);
    vector<T> dist(n, 0);
    dist[0] = inf;
    vector<char> used(n);
    vi pred(n, -1);

    for (int it = 0; it < n; it++)
    {
        int where = -1;
        T best = -1;
        for (int i = 0; i < n; i++)
        if (!used[i] && dist[i] > best)
            best = dist[i], where = i;

        if (where == -1)
            break;
        used[where] = 1;

        for (const auto &e : g[where])
        {
            int dest = e.first;
            T cost = e.second;
            if (min(dist[where], cost) > dist[dest])
            {
                dist[dest] = min(dist[where], cost);
                pred[dest] = where;
            }
        }
    }

    const int dest = n - 1;
    if (pred[dest] == -1 || dist[dest] < val)
        return 0;

    int to_dis = (int)(dist[dest] / val);
   // assert(dist[dest] >= to_dis * val - eps);

    vi path;
    int curv = dest;
    while (curv != -1)
    {
        path.pb(curv);
        curv = pred[curv];
    }

    reverse(ALL(path));
    for (int i = 0; i < sz(path) - 1; i++)
    {
        int x = path[i], y = path[i + 1];
        for (int j = 0; j < sz(g[x]); j++)
        if (g[x][j].first == y)
        {
           // assert(g[x][j].second >= to_dis * val - eps);
            g[x][j].second -= to_dis * val;
            break;
        }
    }

    return to_dis;
}

bool check (T val, graph g, int x)
{
    while (true)
    {
        int y = discharge (val, g);
        if (y >= x)
            return true;
        if (y == 0)
            return false;
        x -= y;
    }

    assert(false);
    return false;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;

    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        T cost = c;
        g[a].pb(mp(b, cost));
        g[b].pb(mp(a, cost));
    }

    T left = 0, right = 1e9;
    for (int it = 0; it < 80; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left *= x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

typedef double T;
const T inf = 1e10;
const T eps = 1e-9;
typedef vector<vector<pair<int, T>>> graph;

int discharge (T val, graph &g)
{
    int n = sz(g);
    vector<T> dist(n, 0);
    dist[0] = inf;
    vector<char> used(n);
    vi pred(n, -1);

    for (int it = 0; it < n; it++)
    {
        int where = -1;
        T best = -1;
        for (int i = 0; i < n; i++)
        if (!used[i] && dist[i] > best)
            best = dist[i], where = i;

        if (where == -1)
            break;
        used[where] = 1;

        for (const auto &e : g[where])
        {
            int dest = e.first;
            T cost = e.second;
            if (min(dist[where], cost) > dist[dest])
            {
                dist[dest] = min(dist[where], cost);
                pred[dest] = where;
            }
        }
    }

    const int dest = n - 1;
    if (pred[dest] == -1 || dist[dest] < val)
        return 0;

    int to_dis = (int)(dist[dest] / val);
    if (to_dis < 0)
        return 0;
   // assert(dist[dest] >= to_dis * val - eps);

    vi path;
    int curv = dest;
    while (curv != -1)
    {
        path.pb(curv);
        curv = pred[curv];
    }

    reverse(ALL(path));
    for (int i = 0; i < sz(path) - 1; i++)
    {
        int x = path[i], y = path[i + 1];
        for (int j = 0; j < sz(g[x]); j++)
        if (g[x][j].first == y)
        {
           // assert(g[x][j].second >= to_dis * val - eps);
            g[x][j].second -= to_dis * val;
            break;
        }
    }

    return to_dis;
}

bool check (T val, graph g, int x)
{
    while (true)
    {
        int y = discharge (val, g);
        if (y >= x)
            return true;
        if (y == 0)
            return false;
        x -= y;
    }

    assert(false);
    return false;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;

    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        T cost = c;
        g[a].pb(mp(b, cost));
        g[b].pb(mp(a, cost));
    }

    T left = 0, right = 1e6;
    for (int it = 0; it < 80; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left = ((left + right) / 2) * x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

struct edge
{
    int to;
    int cap;
};

struct flow
{
    int n, s, t;
    vvi g;
    vector<edge> e;

    flow (int n_) : n(n_), s(0), t(n_ - 1)
    {
        g.resize(n);
    }

    void add_edge (int from, int to, int cap)
    {
        g[from].pb(sz(e));
        e.pb(edge{to, cap});
        g[to].pb(sz(e));
        e.pb(edge{from, 0});
    }

    vector<char> used;
    static const int inf = (int)1e9;

    int dfs (int v, int cur_cst)
    {
        if (v == t)
            return cur_cst;
        used[v] = 1;

        for (int num : g[v])
        if (!used[e[num].to] && e[num].cap > 0)
        {
            int n_cst = min(cur_cst, e[num].cap);
            int rval = dfs(e[num].to, n_cst);
            if (rval > 0)
            {
                e[num].cap -= rval;
                e[num ^ 1].cap += rval;
                return rval;
            }
        }

        return 0;
    }

    int add_flow()
    {
        used.assign(n, 0);
        return dfs(s, inf);
    }

    int max_flow ()
    {
        int ans = 0;
        while (int cur = add_flow())
            ans += cur;

        return ans;
    }
};

typedef double T;
typedef vector<vector<pair<int, int>>> graph;

bool check (T val, const graph &g, int x)
{
    const int n = sz(g);
    flow flow(n);
    for (int i = 0; i < n; i++)
    for (const auto &e : g[i])
    {
        int ncost = -1;
        if (e.second / val > x)
            ncost = x;
        else
            ncost = (int)(e.second / val);
        flow.add_edge(i, e.first, ncost);
    }

    return flow.max_flow() >= x;
}

void solve (int n)
{
    int m, x;
    cin >> m >> x;
    graph g(n);
    for (int i = 0; i < m; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        g[a].pb(mp(b, c));
    }

    T left = 1.0 / x, right = 1e6 + 1;
    for (int it = 0; it < 60; it++)
    {
        T mid = (left + right) / 2;
        if (check(mid, g, x))
            left = mid;
        else
            right = mid;
    }

    left = (left + right) / 2 * x;
    printf("%.20f\n", (double)left);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}


#include <bits/stdc++.h>

using namespace std;

typedef int INT;
typedef long long ll;
typedef long double ld;
#define int ll

typedef pair<int, int> pii;
#define one first
#define two second

#define isize(a) static_cast<int>(a.size())

#define qfor(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define fori(n) qfor(i, 0, n)
#define forj(n) qfor(j, 0, n)

const ld EPS = 1e-15L;
const int INF = 1e9;

struct edge {
    int to, w, pair;
    edge(int _to, int _w, int _pair): to(_to), w(_w), pair(_pair) {};
};

vector<vector<edge>> g0, g;
int n, x;
vector<int> used;
int iter = 0;

int dfs(int v, int flow = INF) {
    if (v == n - 1) {
        return flow;
    }
    used[v] = iter;
    for (e : g[v]) {
        if (e.w > 0 && used[e.to] != iter) {
            int res = dfs(e.to, min(flow, e.w));
            if (res != 0) {
                e.w -= res;
                g[e.to][e.pair].w += res;
                return res;
            }
        }
    }
    return 0;
}

bool check(ld val) {
    fori (n) {
        g[i].clear();
        for (e : g0[i]) {
            g[i].emplace_back(e.to, int(ld(e.w) / val + EPS), e.pair);
        }
    }
    int cnt = x;
    while (cnt > 0) {
        ++iter;
        int res = dfs(0);
        if (res == 0) {
            break;
        }
        cnt -= res;
    }
    return cnt <= 0;
}

INT main(){
#ifndef ONLINE_JUDGE
    if (!freopen("test.in", "r", stdin))
        throw logic_error("qwe");
#endif
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int m;
    cin >> n >> m >> x;
    for (int i = 0; i < m; i++) {
        int st, fi, cc;
        cin >> st >> fi >> cc;
        st--, fi--;
        g[st].emplace_back(fi, cc, g[fi].size());
        g[st].emplace_back(st, cc, g[st].size() - 1);
    }
    ld l = 0, r = 1e6;
    for (int it = 0; it < 80; it++) {
        ld mid = (r + l) / 2;
        if (check(mid))
            l = mid;
        else
            r = mid;
    }
    printf("%.15f\n", (double)(l * x));
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef int INT;
typedef long long ll;
typedef long double ld;
#define int ll

typedef pair<int, int> pii;
#define one first
#define two second

#define isize(a) static_cast<int>(a.size())

#define qfor(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define fori(n) qfor(i, 0, n)
#define forj(n) qfor(j, 0, n)

const ld EPS = 1e-15L;
const int INF = 1e9;

struct edge {
    int to, w, pair;
    edge(int _to, int _w, int _pair): to(_to), w(_w), pair(_pair) {};
};

vector<vector<edge>> g0, g;
int n, x;
vector<int> used;
int iter = 0;

int dfs(int v, int flow = INF) {
    if (v == n - 1) {
        return flow;
    }
    used[v] = iter;
    for (e : g[v]) {
        if (e.w > 0 && used[e.to] != iter) {
            int res = dfs(e.to, min(flow, e.w));
            if (res != 0) {
                e.w -= res;
                g[e.to][e.pair].w += res;
                return res;
            }
        }
    }
    return 0;
}

bool check(ld val) {
    fori (n) {
        g[i].clear();
        for (e : g0[i]) {
            g[i].emplace_back(e.to, int(ld(e.w) / val + EPS), e.pair);
        }
    }
    int cnt = x;
    while (cnt > 0) {
        ++iter;
        int res = dfs(0);
        if (res == 0) {
            break;
        }
        cnt -= res;
    }
    return cnt <= 0;
}

INT main() {
    #ifdef _GLIBCXX_DEBUG
    if (!freopen("test.in", "r", stdin))
        throw logic_error("failed to read test file");
        cerr << fixed << setprecision(10);
    #else
    cin.tie(0);
    #endif
    ios_base::sync_with_stdio(0);
    /// =======================================

    int m;
    cin >> n >> m >> x;

    g.resize(n);
    g0.resize(n);
    used.resize(n);

    fori (m) {
        int a, b, w;
        cin >> a >> b >> w;
        --a, --b;
        g0[a].emplace_back(b, w, g0[b].size());
        g0[b].emplace_back(a, w, g0[a].size() - 1);
    }

    ld l = 0, r = 1e6L + 1;
    while (r - l > EPS) {
        ld mid = (l + r) / 2.L;
        if (check(mid)) {
            l = mid;
        } else {
            r = mid;
        }
    }
    cout << fixed << setprecision(9) << ld(x) * l << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef int INT;
typedef long long ll;
typedef long double ld;
#define int ll

typedef pair<int, int> pii;
#define one first
#define two second

#define isize(a) static_cast<int>(a.size())

#define qfor(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define fori(n) qfor(i, 0, n)
#define forj(n) qfor(j, 0, n)

const ld EPS = 1e-15L;
const int INF = 1e9;

struct edge {
    int to, w, pair;
    edge(int _to, int _w, int _pair): to(_to), w(_w), pair(_pair) {};
};

vector<vector<edge>> g0, g;
int n, x;
vector<int> used;
int iter = 0;

int dfs(int v, int flow = INF) {
    if (v == n - 1) {
        return flow;
    }
    used[v] = iter;
    for (e : g[v]) {
        if (e.w > 0 && used[e.to] != iter) {
            int res = dfs(e.to, min(flow, e.w));
            if (res != 0) {
                e.w -= res;
                g[e.to][e.pair].w += res;
                return res;
            }
        }
    }
    return 0;
}

bool check(ld val) {
    fori (n) {
        g[i].clear();
        for (e : g0[i]) {
            g[i].emplace_back(e.to, int(ld(e.w) / val + EPS), e.pair);
        }
    }
    int cnt = x;
    while (cnt > 0) {
        ++iter;
        int res = dfs(0);
        if (res == 0) {
            break;
        }
        cnt -= res;
    }
    return cnt <= 0;
}

INT main(){
    // if (!freopen("test.in", "r", stdin))
        // throw logic_error("qwe");
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    int m;
    cin >> n >> m >> x;

    g.resize(n);
    g0.resize(n);
    used.resize(n);

    for (int i = 0; i < m; i++) {
        int st, fi, cc;
        cin >> st >> fi >> cc;
        st--, fi--;
        g0[st].emplace_back(fi, cc, g0[fi].size());
        g0[fi].emplace_back(st, cc, g0[st].size() - 1);
    }
    ld l = 0, r = 1e6;
    for (int it = 0; it < 80; it++) {
        ld mid = (r + l) / 2;
        if (check(mid))
            l = mid;
        else
            r = mid;
    }
    printf("%.15f\n", (double)(l * x));
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef int INT;
typedef long long ll;
typedef long double ld;
#define int ll

typedef pair<int, int> pii;
#define one first
#define two second

#define isize(a) static_cast<int>(a.size())

#define qfor(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define fori(n) qfor(i, 0, n)
#define forj(n) qfor(j, 0, n)

const ld EPS = 1e-10L;

struct edge {
    int x, w, pair;
    edge(int _x, int _w, int _pair): x(_x), w(_w), pair(_pair) {};
};

vector<vector<edge>> g0, g;
int n, x;
vector<int> used;
int iter = 0;

bool dfs(int v) {
    if (used[v] == iter) {
        return false;
    }
    if (v == n - 1) {
        return true;
    }
    used[v] = iter;
    for (e : g[v]) {
        if (e.w > 0) {
            --e.w;
            ++g[e.x][e.pair].w;
            if (dfs(e.x)) {
                return true;
            }
            ++e.w;
            --g[e.x][e.pair].w;
        }
    }
    return false;
}

bool check(ld val) {
    // cerr << val << endl;
    fori (n) {
        g[i].clear();
        for (e : g0[i]) {
            g[i].emplace_back(e.x, int(ld(e.w) / val + EPS), e.pair);
            // cerr << g[i].back().w << ' ';
        }
        // cerr << endl;
    }
    fori (x) {
        ++iter;
        if (!dfs(0)) {
            return false;
        }
    }
    return true;
}

INT main() {
    #ifdef _GLIBCXX_DEBUG
    if (!freopen("test.in", "r", stdin))
        throw logic_error("failed to read test file");
        cerr << fixed << setprecision(10);
    #else
    cin.tie(0);
    #endif
    ios_base::sync_with_stdio(0);
    /// =======================================

    int m;
    cin >> n >> m >> x;

    g.resize(n);
    g0.resize(n);
    used.resize(n);

    fori (m) {
        int a, b, w;
        cin >> a >> b >> w;
        --a, --b;
        g0[a].emplace_back(b, w, g0[b].size());
        g0[b].emplace_back(a, w, g0[a].size() - 1);
    }

    ld l = 0, r = 1e6L + 1;
    while (r - l > EPS) {
        ld mid = (l + r) / 2.L;
        if (check(mid)) {
            l = mid;
        } else {
            r = mid;
        }
    }
    cout << fixed << setprecision(9) << x * l << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef int INT;
typedef long long ll;
typedef long double ld;
#define int ll

typedef pair<int, int> pii;
#define one first
#define two second

#define isize(a) static_cast<int>(a.size())

#define qfor(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define fori(n) qfor(i, 0, n)
#define forj(n) qfor(j, 0, n)

const ld EPS = 1e-15L;
const int INF = 1e9;

struct edge {
    int to, w, pair;
    edge(int _to, int _w, int _pair): to(_to), w(_w), pair(_pair) {};
};

vector<vector<edge>> g0, g;
int n, x;
vector<int> used;
int iter = 0;

int dfs(int v, int flow = INF) {
    if (v == n - 1) {
        return flow;
    }
    used[v] = iter;
    for (e : g[v]) {
        if (e.w > 0 && used[e.to] != iter) {
            int res = dfs(e.to, min(flow, e.w));
            if (res != 0) {
                e.w -= res;
                g[e.to][e.pair].w += res;
                return res;
            }
        }
    }
    return 0;
}

bool check(ld val) {
    fori (n) {
        g[i].clear();
        for (e : g0[i]) {
            g[i].emplace_back(e.to, int(e.w > val * 1e6L ? 1e6L + 1 : ld(e.w) / val + EPS), e.pair);
        }
    }
    int cnt = x;
    while (cnt > 0) {
        ++iter;
        int res = dfs(0);
        if (res == 0) {
            break;
        }
        cnt -= res;
    }
    return cnt <= 0;
}

INT main() {
    #ifdef _GLIBCXX_DEBUG
    if (!freopen("test.in", "r", stdin))
        throw logic_error("failed to read test file");
        cerr << fixed << setprecision(10);
    #else
    cin.tie(0);
    #endif
    ios_base::sync_with_stdio(0);
    /// =======================================

    int m;
    cin >> n >> m >> x;

    g.resize(n);
    g0.resize(n);
    used.resize(n);

    fori (m) {
        int a, b, w;
        cin >> a >> b >> w;
        --a, --b;
        g0[a].emplace_back(b, w, g0[b].size());
        g0[b].emplace_back(a, w, g0[a].size() - 1);
    }

    ld l = 0, r = 1e6L + 1;
    fori (100) {
        ld mid = (l + r) / 2.L;
        if (check(mid)) {
            l = mid;
        } else {
            r = mid;
        }
    }
    cout << fixed << setprecision(10) << ld(x) * l << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef int INT;
typedef long long ll;
typedef long double ld;
#define int ll

typedef pair<int, int> pii;
#define one first
#define two second

#define isize(a) static_cast<int>(a.size())

#define qfor(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define fori(n) qfor(i, 0, n)
#define forj(n) qfor(j, 0, n)

const ld EPS = 1e-10L;

struct edge {
    int x, w, pair;
    edge(int _x, int _w, int _pair): x(_x), w(_w), pair(_pair) {};
};

vector<vector<edge>> g0, g;
int n, x;
vector<int> used;
int iter = 0;

bool dfs(int v) {
    if (used[v] == iter) {
        return false;
    }
    if (v == n - 1) {
        return true;
    }
    used[v] = iter;
    for (e : g[v]) {
        if (e.w > 0) {
            --e.w;
            ++g[e.x][e.pair].w;
            if (dfs(e.x)) {
                return true;
            }
            ++e.w;
            --g[e.x][e.pair].w;
        }
    }
    return false;
}

bool check(ld val) {
    // cerr << val << endl;
    fori (n) {
        g[i].clear();
        for (e : g0[i]) {
            g[i].emplace_back(e.x, int(ld(e.w) / val + EPS), e.pair);
            // cerr << g[i].back().w << ' ';
        }
        // cerr << endl;
    }
    fori (x) {
        ++iter;
        if (!dfs(0)) {
            return false;
        }
    }
    return true;
}

INT main() {
    #ifdef _GLIBCXX_DEBUG
    if (!freopen("test.in", "r", stdin))
        throw logic_error("failed to read test file");
        cerr << fixed << setprecision(10);
    #else
    cin.tie(0);
    #endif
    ios_base::sync_with_stdio(0);
    /// =======================================

    int m;
    cin >> n >> m >> x;

    g.resize(n);
    g0.resize(n);
    used.resize(n);

    vector<int> we;

    fori (m) {
        int a, b, w;
        cin >> a >> b >> w;
        --a, --b;
        g0[a].emplace_back(b, w, g0[b].size());
        g0[b].emplace_back(a, w, g0[a].size() - 1);
        we.push_back(w);
    }

    sort(we.begin(), we.end());
    we.resize(unique(we.begin(), we.end()) - we.begin());

    vector<int> left_w(we.size(), -1), right_w(we.size(), -1);
    vector<int> cur_w(we.size());

    ld l = 0, r = 1e6L + 1;
    while (r - l > EPS) {
        ld mid = (l + r) / 2.L;
        fori (we.size()) {
            cur_w[i] = int(ld(we[i]) / mid + EPS);
        }
        if (cur_w == left_w) {
            l = mid;
            continue;
        }
        if (cur_w == right_w) {
            r = mid;
            continue;
        }
        if (check(mid)) {
            l = mid;
            left_w = cur_w;
        } else {
            r = mid;
            right_w = cur_w;
        }
    }
    cout << fixed << setprecision(9) << x * l << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef int INT;
typedef long long ll;
typedef long double ld;
#define int ll

typedef pair<int, int> pii;
#define one first
#define two second

#define isize(a) static_cast<int>(a.size())

#define qfor(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define fori(n) qfor(i, 0, n)
#define forj(n) qfor(j, 0, n)

const ld EPS = 1e-10L;
const int INF = 1e9;

struct edge {
    int to, w, pair;
    edge(int _to, int _w, int _pair): to(_to), w(_w), pair(_pair) {};
};

vector<vector<edge>> g0, g;
int n, x;
vector<int> used;
int iter = 0;

int dfs(int v, int flow = INF) {
    if (used[v] == iter) {
        return 0;
    }
    if (v == n - 1) {
        return flow;
    }
    used[v] = iter;
    for (e : g[v]) {
        if (e.w > 0 && used[e.to] != iter) {
            int res = dfs(e.to, min(flow, e.w));
            if (res != 0) {
                e.w -= res;
                g[e.to][e.pair].w += res;
                return res;
            }
        }
    }
    return 0;
}

bool check(ld val) {
    fori (n) {
        g[i].clear();
        for (e : g0[i]) {
            g[i].emplace_back(e.to, int(ld(e.w) / val), e.pair);
        }
    }
    int cnt = x;
    while (cnt > 0) {
        ++iter;
        int res = dfs(0);
        if (res == 0) {
            break;
        }
        cnt -= res;
    }
    return cnt <= 0;
}

INT main() {
    #ifdef _GLIBCXX_DEBUG
    if (!freopen("test.in", "r", stdin))
        throw logic_error("failed to read test file");
        cerr << fixed << setprecision(10);
    #else
    cin.tie(0);
    #endif
    ios_base::sync_with_stdio(0);
    /// =======================================

    int m;
    cin >> n >> m >> x;

    g.resize(n);
    g0.resize(n);
    used.resize(n);

    fori (m) {
        int a, b, w;
        cin >> a >> b >> w;
        --a, --b;
        g0[a].emplace_back(b, w, g0[b].size());
        g0[b].emplace_back(a, w, g0[a].size() - 1);
    }

    ld l = 0, r = 1e6L + 1;
    while (r - l > EPS) {
        ld mid = (l + r) / 2.L;
        if (check(mid)) {
            l = mid;
        } else {
            r = mid;
        }
    }
    cout << fixed << setprecision(9) << x * l << endl;
}