#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#define FOR(i,a,b) for(i=(a);i<=(b);i++)
#define ROF(i,a,b) for(i=(a);i>=(b);i--)
#define mmt(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define mp make_pair
#define M 1000100
#define MaxL 1000100
#define N 2010
#define inf 1e9
using namespace std;
typedef long long LL;
typedef long double LD;
int len=1,maxflow=0,n,m,K,a4[M],a1[M],a2[M],a3[M];
int pre[M],last[M],e[M],ca[M],co[M],q[MaxL+1000],dis[N],vis[N],path[M],source,target;
void add(int x,int y,int z,int w)
{
  pre[++len]=last[x],last[x]=len,e[len]=y,ca[len]=z,co[len]=w;
  pre[++len]=last[y],last[y]=len,e[len]=x,ca[len]=0,co[len]=-w;
}
int Nxt(int x){if (x==MaxL-1) return 1;return x+1;}
int MCMF()
{
  int __ans=0;
  while(1)
  {
    memset(dis,0x7e,sizeof(dis));
    memset(vis,0,sizeof(vis));
    int h=0,t=1;
    q[1]=source,vis[source]=0,dis[source]=0;
    while(h<t)
    {
      h=Nxt(h);int u=q[h];
      for(int p=last[u];p;p=pre[p])
      {
        int v=e[p],rm=ca[p],Cost=co[p];
        if(rm&&dis[u]+Cost<dis[v])
        {
          dis[v]=dis[u]+Cost,path[v]=p;
          if(!vis[v])
          {
            t=Nxt(t);
            q[t]=v;
            vis[v]=1;
          }
        }
      }
      vis[u]=0;
    }
    if(dis[target]==0x7e7e7e7e)break;
    int tf=inf;
    for(int u=target;u!=source;u=e[path[u]^1])tf=min(tf,ca[path[u]]);
    maxflow+=tf,__ans+=tf*dis[target];
    for(int u=target;u!=source;u=e[path[u]^1]) ca[path[u]]-=tf,ca[path[u]^1]+=tf;
  }
  return __ans;
}
int main()
{
  scanf("%d%d%d",&n,&m,&K);
  int i;source=1;target=n;
  FOR(i,1,m)
  {
    scanf("%d%d%d%d",&a1[i],&a2[i],&a3[i],&a4[i]);
    add(a1[i],a2[i],a3[i],0);
  }
  //FOR(i,1,len) printf("%d ",ca[i]);printf("\n");
  maxflow=0;
  MCMF();
  printf("%d ",maxflow);
  //FOR(i,1,len) printf("%d ",ca[i]);printf("\n");
  //for(i=2;i<len;i+=2) ca[i+1]=0;
  FOR(i,1,m) add(a1[i],a2[i],inf,a4[i]);
  source=n+1;add(source,1,K,0);maxflow=0;
  int ans=MCMF();printf("%d\n",ans);
}