Problem: problem

AOR Ika is at the $ S $ th bus stop at time $ 0 $ and wants to go from there to the $ G $ th bus stop. The number of bus stops $ N $ and $ M $ routes (*) connecting different bus stops are given. The bus stops are numbered $ 1, \ dots, and N $, respectively. Each route consists of $ 4 $ values: origin $ u $, destination $ v $, departure time $ t $, and travel time $ c $. You can catch the bus if you are at the departure $ u $ at the time $ t $ and arrive at the destination $ v $ at the time $ t + c $. While not on the bus, AOR Ika gets wet in the rain. When heading to the $ G $ th bus stop through the route that minimizes the time of getting wet in the rain, output the total time of getting wet in the rain from the time $ 0 $ to the arrival at the $ G $ th bus stop.

(*) In graph theory terms, a path is a sequence of vertices and edges, but please note that it is used here to mean edges.



input

Input is given from standard input in the following format.

$ N \ M \ S \ G $
$ u_1 \ v_1 \ t_1 \ c_1 $
$ \ vdots $
$ u_M \ v_M \ t_M \ c_M $

output

Print the minimum amount of time you get wet in one line. Also, output a line break at the end.

Example

Input

2 2 1 2
1 2 10 100
1 2 5 500


Output

5

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline void chmin(T &l,T r){l=min(l,r);}
template <typename T>inline void chmax(T &l,T r){l=max(l,r);}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
typedef tuple<int,int,int,LL> T;
const LL INF=1e15;
LL a[212345];
LL b[212345];
LL c[212345];
LL t[212345];

int main(){
    int N,M,S,G;
    cin>>N>>M>>S>>G;
    priority_queue<T> sc;
    vector<LL> ame(N+1,INF);
    REP(i,M){
        cin>>a[i]>>b[i]>>t[i]>>c[i];
        sc.push(T(-t[i],0,i,0));
    }
    ame[S]=0;
    LL res=INF;
    while(sc.size()){
        int tt,type,e;LL cww;
        tie(tt,type,e,cww)=sc.top();
        sc.pop();
        LL bg=t[e];
        LL ed=t[e]+c[e];
        if(type==0){
            LL cost=ame[a[e]]+t[e];
            sc.push(T(-ed,1,e,cost));
        }
        else{
            if(b[e]==G)chmin(res,cww);
            chmin(ame[b[e]],cww-t[e]-c[e]);
        }

    }
    cout<<res<<endl;
    return 0;
}