#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300 + 10;
const int MAXM = 1e5 + 10;
const int MOD = 1e9 + 7;
int T, n, q, t, a[MAXN], dp[MAXN][MAXM], deg[MAXN], cnt[MAXN];
vector<int> g[MAXN];
bool visited[MAXN];
void dfs(int v, int x) {
  visited[v] = true;
  cnt[v] = 0;
  for (auto u : g[v]) {
    if (!visited[u]) {
      dfs(u, x + a[v]);
      cnt[v] = cnt[u] + 1;
    }
  }
  t -= a[v] * cnt[v];
  a[v] += x;
  if (t < 0) {
    cout << 0 << '\n';
    exit(0);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  T = 1;
  while (T--) {
    cin >> n >> q >> t;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (int i = 1; i <= q; i++) {
      int u, v;
      cin >> u >> v;
      g[u].push_back(v);
      deg[v]++;
    }
    for (int i = 1; i <= n; i++) {
      if (!deg[i]) {
        dfs(i, 0);
      }
    }
    for (int i = 1; i <= n; i++) {
      if (!visited[i]) {
        cout << 0 << '\n';
        return 0;
      }
    }
    for (int i = 1; i <= n; i++) {
      dp[i][0] = 1;
      for (int j = 1; j <= t; j++) {
        dp[i][j] = dp[i - 1][j];
        if (a[i] <= j) {
          dp[i][j] = (dp[i][j] + dp[i][j - a[i]]) % MOD;
        }
      }
    }
    cout << dp[n][t] << '\n';
  }
  return 0;
}
