1 #include <bits/stdc++.h>
2 #define ll long long
3 #define eps 1e-5
4 using namespace std;
5 inline int read(){
6 int x=0;int f=1;char ch=getchar();
7 while(!isdigit(ch)) {if(ch==‘-‘) f=-1;ch=getchar();}
8 while(isdigit(ch)) {x=x*10+ch-‘0‘;ch=getchar();}
9 return x*f;
10 }
11 const int MAXN=2e3+10;
12 struct node{
13 int x,y,next,back;
14 double flow;
15 }e[MAXN<<1],s[MAXN];
16 int linkk[MAXN<<1],level[MAXN],len=0,n,m,p;
17 inline void insert(int xx,int yy,double f){
18 e[++len].y=yy;e[len].next=linkk[xx];linkk[xx]=len;e[len].flow=f;e[len].back=len+1;
19 e[++len].y=xx;e[len].next=linkk[yy];linkk[yy]=len;e[len].flow=0;e[len].back=len-1;
20 }
21 inline void build(double num){
22 memset(linkk,0,sizeof(linkk));
23 len=0;
24 for(int i=1;i<=m;i++){
25 insert(s[i].x,s[i].y,min(num,s[i].flow));
26 }
27 }
28 void init(){
29 n=read();m=read();p=read();
30 for(int i=1;i<=m;i++){
31 s[i].x=read();s[i].y=read();s[i].flow=read();
32 }
33 build(23712837);
34 }
35 int q[MAXN<<4],head,tail;
36 inline bool getlevel(){
37 memset(level,-1,sizeof(level));
38 head=tail=0;
39 q[++tail]=1;
40 level[1]=0;
41 while(head<tail){
42 int tn=q[++head];
43 for(int i=linkk[tn];i;i=e[i].next){
44 if(level[e[i].y]==-1&&e[i].flow){
45 level[e[i].y]=level[tn]+1;
46 q[++tail]=e[i].y;
47 }
48 }
49 }
50 return level[n]>=0;
51 }
52 inline double getmaxflow(int st,double flow){
53 if(st==n) return flow;
54 double maxflow=0;double d=0;
55 for(int i=linkk[st];i&&maxflow<flow;i=e[i].next){
56 if(level[e[i].y]==level[st]+1&&e[i].flow>0){
57 if(d=getmaxflow(e[i].y,min(flow-maxflow,e[i].flow))){
58 e[i].flow-=d;
59 e[e[i].back].flow+=d;
60 maxflow+=d;
61 }
62 }
63 }
64 if(!maxflow) level[st]=-1;
65 return maxflow;
66 }
67 inline double dinic(){
68 double sum=0;double ans;
69 while(getlevel()){
70 while(ans=getmaxflow(1,312323233)){
71 sum+=ans;
72 }
73 }
74 return sum;
75 }
76 int main(){
77 //freopen("All.in","r",stdin);
78 //freopen("zhang.out","w",stdout);
79 init();
80 double k=dinic();
81 cout<<k<<endl;
82 double l=0;double r=0;
83 for(int i=1;i<=m;i++){
84 r=max(r,s[i].flow);
85 }
86 while((r-l)>eps){
87 //printf("%lf %lf\n",l,r);
88 double mid=(l+r)*0.5;
89 build(mid);
90 double t=dinic();
91 if(abs(t-k)<eps) r=mid;
92 else l=mid;
93 }
94 printf("%.4f\n",l*p);
95 return 0;
96 }