#include <bits/stdc++.h>
using namespace std;
const int Maxn=50005;
const int Maxm=125005;
const int inf=1e9;
int n,m,size=-1,s,t,S,T,tot,ans,sum,head,tail;
int first[Maxn],tmp[Maxn],depth[Maxn],p[Maxn],in[Maxn],out[Maxn];
struct shu{int to,next,len;};
shu edge[Maxm<<2];
inline int get_int()
{
int x=0,f=1;
char c;
for(c=getchar();(!isdigit(c))&&(c='-');c=getchar());
if(c=='-') {f=-1;c=getchar();}
for(;isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+c-'0';
return x*f;
}
inline void build(int x,int y,int z)
{
edge[++size].next=first[x];
first[x]=size;
edge[size].to=y;
edge[size].len=z;
}
inline void pre()
{
build(t,s,inf),build(s,t,0),T=n+1;
for(int i=1;i<=n;i++)
{
int num=in[i]-out[i];
if(num>0) build(S,i,num),build(i,S,0),sum+=num;
if(num<0) build(i,T,-num),build(T,i,0);
}
}
inline bool bfs(int s,int t)
{
memset(depth,0,sizeof(depth));
head=0,tail=1;
p[1]=s,depth[s]=1;
while(head<tail)
{
int point=p[++head];
for(int u=first[point];~u;u=edge[u].next)
{
int to=edge[u].to;
if(!depth[to] && edge[u].len)
{
depth[to]=depth[point]+1;
p[++tail]=to;
if(to==t) return 1;
}
}
}
return 0;
}
inline int mn(int x,int y){return x < y ? x : y;}
inline int dinic(int point,int flow,int t)
{
if(point==t) return flow;
int sum=0;
for(int &u=tmp[point];~u&&sum<flow;u=edge[u].next)
{
int to=edge[u].to;
if(depth[to]==depth[point]+1 && edge[u].len)
{
int minn=dinic(to,mn(edge[u].len,flow-sum),t);
//if(!(flow-sum)){depth[to]=0;break;}
edge[u].len-=minn,edge[u^1].len+=minn,sum+=minn;
}
}
return sum;
}
int main()
{
memset(first,-1,sizeof(first));
n=get_int(),m=get_int(),s=get_int(),t=get_int();
for(int i=1;i<=m;i++)
{
int x=get_int(),y=get_int(),low=get_int(),up=get_int();
if(y==t && x==s) continue;
in[y]+=low,out[x]+=low,build(x,y,up-low),build(y,x,0);
}
tot=size+1;
pre();
while(bfs(S,T))
{
memcpy(tmp,first,sizeof(first));
ans+=dinic(S,inf,T);
}
if(sum!=ans) {cout<<"please go home to sleep\n";return 0;}
first[S]=first[T]=0;
ans=edge[tot^1].len; //注意!
for(int u=tot;u<=size;u++) edge[u].len=0;
while(bfs(t,s))
{
memcpy(tmp,first,sizeof(first));
ans-=dinic(t,inf,s);
}
cout<<ans<<"\n";
return 0;
}