#include <bits/stdc++.h>
using namespace std;
const int maxn = 300 + 10;
const int maxt = 1000 * 100 + 100;
const int inf = 1000 * 1000 * 1000 + 7;
long long d[maxn][maxt], a[maxn], b[maxn];
long long mark[maxn], par[maxn], n, q, t, vis[maxn];
vector<int> adj[maxn], path;
int root(int x) {
  if (vis[x] == true) return -1;
  vis[x] = true;
  return (par[x] == -1 ? x : root(par[x]));
}
void dfs(int v) {
  mark[v] = true;
  path.push_back(v);
  for (int i = 0; i < adj[v].size(); i++) {
    int tmp = adj[v][i];
    if (!mark[tmp]) dfs(tmp);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> q >> t;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(par, -1, sizeof par);
  for (int i = 1; i <= q; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    par[y] = x;
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (!mark[i]) {
      path.clear();
      int f = root(i);
      if (f == -1) {
        cout << "0" << endl;
        return 0;
      }
      dfs(f);
      int s = 0;
      for (int i = 0; i < path.size(); i++) {
        s += a[path[i]];
        cnt++;
        b[cnt] = s;
      }
      path.clear();
    }
  for (int i = 1; i <= n; i++) t -= (b[i] - a[i]);
  if (t < 0) cout << "0" << endl;
  if (t == 0) cout << "1" << endl;
  if (t > 0) {
    for (int i = 1; i <= n; i++) d[i][0] = 1;
    for (int j = 1; j <= t; j++)
      for (int i = 1; i <= n; i++) {
        d[i][j] = d[i - 1][j];
        if (j >= b[i]) d[i][j] = (d[i][j] + d[i][j - b[i]]) % inf;
      }
    cout << d[n][t] << endl;
  }
  return 0;
}
