#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int SIZE=2*1e5;
const LL INF=1LL<<60;
const LL p=7+1e9;
LL N,M,s,t,a,b,d[SIZE];
LL DP[SIZE];
Vpr edges[SIZE];
LL solve(){
	cin >> N >> M >> s >> t;

	FOR(i,1,N+1){
		cin >> d[i];
		edges[i].PB(pr(0,i-1));
		if(i==s) DP[i]=0;
		else DP[i]=INF;
	}
	PQ qu;
	REP(i,M){
		cin >> a >> b;
		edges[a].PB(pr(d[b],b));
	}
	qu.push(pr(0,s));
	while(!qu.empty()){
		int now=qu.top().second,dists=qu.top().first;
		qu.pop();
		if(dists>DP[now]) continue;
		REP(i,edges[now].size()){
			int next=edges[now][i].second;
			int ndist=dists+edges[now][i].first;
			if(DP[next]>ndist){
				DP[next]=ndist;
				qu.push(pr(ndist,next));
			}
		}
	}
	return DP[t];
}
int main(){
	cout << solve() << endl;
	return 0;
}