#include "bits/stdc++.h"
using namespace std;
// http://judge.u-aizu.ac.jp/onlinejudge/cdescription.jsp?cid=ACPC2017Day1&pid=D
typedef long long ll;
#define INF 1<<30
#define LINF 1LL<<60

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N, M, s, t; cin >> N >> M >> s >> t;
	s--; t--;
	vector<int> d(N);
	vector<vector<int>> G(N);
	for (int i = 0; i < N;i++) cin >> d[i];
	for (int i = 0; i < M;i++) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
	}
	for (int i = 1; i < N;i++)G[i].push_back(i - 1);
	vector<ll> dist(N, INF);
	queue<pair<int, int>> q;
	q.push({ s,s });
	dist[s] = 0;
	while (!q.empty()) {
		auto p = q.front(); q.pop();
		int n = p.first, max_n = p.second;
		for (auto next : G[n]) {
			int cost = d[next];
			if (next < max_n) cost = 0;
			if (dist[next] > dist[n] + cost) {
				dist[next] = dist[n] + cost;
				q.push({ next,max(max_n,next) });
			}
		}
	}
	cout << dist[t] << endl;
	return 0;
}