/*
可以知道,最后P一定分配在最大的容量的那条边,那么就要使最大容量最小,二分答案。
*/
#include<cstdio>
#include<iostream>
#include<queue>
#include<cstring>
#include<cmath>
#define inf 1000000000
#define N 2010
#define eps 0.0001
using namespace std;
int head[N],dis[N],n,m,p,cnt=1,S,T;int q[N];
struct node{int v,pre;double f;}e[N*2];
struct Node{int u,v,w;}road[N*2];
void add(int u,int v,double f){
e[++cnt].v=v;e[cnt].f=f;e[cnt].pre=head[u];head[u]=cnt;
e[++cnt].v=u;e[cnt].f=0;e[cnt].pre=head[v];head[v]=cnt;
}
bool bfs(){
memset(dis,-1,sizeof(dis));
queue<int>q;q.push(S);dis[S]=0;
while(!q.empty()){
int u=q.front();q.pop();
for(int i=head[u];i;i=e[i].pre)
if(e[i].f>0&&dis[e[i].v]==-1){
dis[e[i].v]=dis[u]+1;
q.push(e[i].v);
if(e[i].v==T) return true;
}
}
return dis[T]!=-1;
}
double dinic(int x,double f){
if(x==T)return f;
double rest=f;
for(int i=head[x];i;i=e[i].pre){
if(e[i].f&&dis[e[i].v]==dis[x]+1){
double t=dinic(e[i].v,min(rest,e[i].f));
if(!t) dis[e[i].v]=-1;
e[i].f-=t;
e[i^1].f+=t;
rest-=t;
}
}
return f-rest;
}
double work(double mid){
memset(head,0,sizeof(head));
cnt=1;double maxflow=0;
for(int i=1;i<=m;i++)
add(road[i].u,road[i].v,min((double)road[i].w,mid));
while(bfs())
maxflow+=dinic(S,inf);
return maxflow;
}
int main(){
scanf("%d%d%d",&n,&m,&p);
S=1;T=n;double maxf=0;
for(int i=1;i<=m;i++){
scanf("%d%d%d",&road[i].u,&road[i].v,&road[i].w);
maxf=max(maxf,(double)road[i].w);
}
double maxflow=work(maxf);
printf("%d\n",(int)maxflow);
double l=0,r=maxf,ans=r;
while(r-l>eps){
double mid=(l+r)/2.0;
if(fabs(work(mid)-maxflow)<eps)
r=mid,ans=mid;
else l=mid;
}
printf("%.4lf",ans*(double)p);
return 0;
}