#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
const int N = 10005;
const int M = 20005;
int v[N], n, m, a, b, cnt, fr, to, dis[N], cp[N];
bool vis[N];
struct {
int next, to, v;
} edge[M];
int head[N];
queue<int> q;
void addEdge(int u, int v, int w)
{
edge[++cnt].next = head[u];
edge[cnt].to = v;
edge[cnt].v = w;
head[u] = cnt;
}
int SPFA()
{
memset(dis, 0x3f, sizeof(dis));
dis[a] = 0;
q.push(a);
while (!q.empty()) {
int u = q.front();
q.pop();
vis[u] = 0;
for (int to = head[u]; to; to = edge[to].next) {
int v = edge[to].to;
int w = edge[to].v;
if (dis[v] > dis[u] + w) {
dis[v] = dis[u] + w;
cp[v] = cp[u] + 1;
if (cp[v] >= n)
return false;
if (!vis[v])
q.push(v), vis[v] = true;
}
}
}
return true;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m >> a >> b;
for (int i = 1; i <= n; i++)
cin >> v[i];
while (m--) {
cin >> fr >> to;
addEdge(fr, to, v[to + 1] - v[fr + 1] + 1);
}
if (SPFA() && dis[b] != 0x3f3f3f3f)
cout << dis[b];
else
cout << "No solution";
return 0;
}