Why my approach is wrong?

https://codeforces.com/contest/1020/problem/A

my approach:-
int t,n,r,s,c,h,a,b,k,f1,f2,t1,t2;
cin>>n>>h>>a>>b>>k;
while(k–)
{
cin>>t1>>f1>>t2>>f2;
int ans=abs(t2-t1);
if(ans==0)
{
ans+=abs(f2-f1);
}
else if(f1>=a && f1<=b)
{
ans+=abs(f2-f1);
}
else if(f1<a || f1>b)
{
ans+=min(abs(f1-a),abs(f1-b));
k=min(abs(f1-a),abs(f1-b));
ans+=abs(f2-abs(f1-k));
}
cout<<ans<<endl;