//
// main.cpp
// sdoi2003费用流
//
// Created by Candy on 25/11/2016.
// Copyright © 2016 Candy. All rights reserved.
//
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=105,M=1005,INF=1e9;
const double eps=1e-5;
int read(){
char c=getchar();int x=0,f=1;
while(c<‘0‘||c>‘9‘){if(c==‘-‘)f=-1; c=getchar();}
while(c>=‘0‘&&c<=‘9‘){x=x*10+c-‘0‘; c=getchar();}
return x*f;
}
int n,m,p,u,v,c,s,t;
struct data{
int u,v,c;
}a[M];
struct edge{
int v,ne;
double c,f;
}e[M<<1];
int h[N],cnt=0;
inline void ins(int u,int v,double c){
cnt++;
e[cnt].v=v;e[cnt].c=c;e[cnt].f=0;e[cnt].ne=h[u];h[u]=cnt;
cnt++;
e[cnt].v=u;e[cnt].c=0;e[cnt].f=0;e[cnt].ne=h[v];h[v]=cnt;
}
void build(double mid){
cnt=0;
memset(h,0,sizeof(h));
for(int i=1;i<=m;i++) ins(a[i].u,a[i].v,min((double)a[i].c,mid));
}
int cur[N];
int d[N],vis[N],q[N],head,tail;
bool bfs(){
memset(vis,0,sizeof(vis));
memset(d,0,sizeof(d));
head=tail=1;
d[s]=0;vis[s]=1;q[tail++]=s;
while(head!=tail){
int u=q[head++];
for(int i=h[u];i;i=e[i].ne){
int v=e[i].v;
if(!vis[v]&&e[i].c>e[i].f){
d[v]=d[u]+1;vis[v]=1;
q[tail++]=v;
if(v==t) return 1;
}
}
}
return 0;
}
double dfs(int u,double a){
if(u==t||a==0) return a;
double flow=0,f;
for(int &i=cur[u];i;i=e[i].ne){
int v=e[i].v;
if(d[v]==d[u]+1&&(f=dfs(v,min(a,e[i].c-e[i].f)))>0){
flow+=f;
e[i].f+=f;
e[((i-1)^1)+1].f-=f;
a-=f;
if(a==0) break;
}
}
return flow;
}
double dinic(){
double flow=0;
while(bfs()){
for(int i=1;i<=n;i++) cur[i]=h[i];
flow+=dfs(s,INF);
}
return flow;
}
int main(int argc, const char * argv[]) {
n=read();m=read();p=read();s=1;t=n;
double l=0,r=0;
for(int i=1;i<=m;i++){
a[i].u=read(),a[i].v=read(),a[i].c=read();
ins(a[i].u,a[i].v,a[i].c);r=max(r,(double)a[i].c);
}
//r+=eps;
double old=dinic();
while(r-l>eps){
double mid=(l+r)*0.5;//printf("%f %f\n",l,r);
build(mid);
double mx=dinic();
if(fabs(mx-old)<eps) r=mid;
else l=mid;
}
printf("%d\n%.4f",(int)old,l*p);
return 0;
}