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
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 21474836

int main(){
  int n,m,s,g;
  cin>>n>>m>>s>>g;
  s--;g--;
  vector<int> u(m),v(m),t(m),c(m);
  rep(i,m) cin>>u[i]>>v[i]>>t[i]>>c[i];
  rep(i,m) u[i]--,v[i]--;

  vector<vector<int>> st(200001), gt(200001), gc(200001);
  rep(i,m) st[t[i]].pb(i);

  vector<int> bs(n,-INF);
  bs[s] = 0;

  int ans = INF;
  rep(i,200001){
    int k = gt[i].size();
    rep(j,k){//dbg(i),dbg(bs);
      int arr = gt[i][j];
      int cost = gc[i][j];
      bs[arr] = max(bs[arr], cost);
      if(arr == g){
        ans = min(ans, i-bs[arr]);
      }
    }
    for(auto id : st[i]){//dbg(i),dbg(bs);
      gt[i+c[id]].pb(v[id]);
      gc[i+c[id]].pb(bs[u[id]] + c[id]);
    }
  }

  cout << ans << endl;

  return 0;
}