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

struct cww{cww(){
    ios::sync_with_stdio(false);cin.tie(0);
}}star;

#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 REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}


typedef vector<LL> V;
typedef vector<V> VV;
const LL INF=1e15;
int a[212345];
int b[212345];
LL c[212345];
LL d[212345];
int main(){
    int N,M,s,t;
    cin>>N>>M>>s>>t;s--;t--;
    V dist(N,INF);
    VV g(N);
    REP(i,N)cin>>d[i];
    REP(i,M){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
        c[i]=d[b[i]];
        g[a[i]].pb(i);
    }
    REP(i,N-1){
        a[i+M]=i+1;
        b[i+M]=i;
        c[i+M]=0;
        g[a[i+M]].pb(i+M);
    }
    dist[s]=0;
    priority_queue<pair<LL,int>> Q;
    Q.push({0ll,s});
    while(Q.size()){
        auto q=Q.top();Q.pop();
        LL cost=-q.fi;
        int v=q.se;
        if(cost>dist[v])continue;
        for(auto &e:g[v]){
            int u=b[e];
            LL nxtcost=c[e]+cost;
            if(chmin(dist[u],nxtcost)){
                Q.push({-nxtcost,u});
            }
        }
    }
    cout<<dist[t]<<endl;
    return 0;
}