#include <bits/stdc++.h>
using namespace std;
vector<int> e[305];
int vis[305];
long long sum[305];
long long a[305];
bool gen;
int dp[100001][305];
long long dfs(int u) {
  if (vis[u] == 2) {
    return sum[u];
  }
  if (vis[u] == 1) {
    gen = 1;
    return 0;
  }
  vis[u] = 1;
  sum[u] = a[u];
  for (int v : e[u]) {
    sum[u] += dfs(v);
  }
  vis[u] = 2;
  return sum[u];
}
int main() {
  long long n, q, t;
  cin >> n >> q >> t;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= q; i++) {
    int b, c;
    cin >> b >> c;
    e[c].push_back(b);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      dfs(i);
    }
  }
  if (gen) {
    cout << 0 << '\n';
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    t -= sum[i] - a[i];
  }
  dp[0][n + 1] = 1;
  for (int i = n; i >= 1; i--) {
    for (long long baki = 0; baki <= t; baki++) {
      if (sum[i] <= baki) {
        dp[baki][i] = (dp[baki][i] + dp[baki - sum[i]][i]) % 1000000007;
      }
      dp[baki][i] = (dp[baki][i] + dp[baki][i + 1]) % 1000000007;
    }
  }
  if (t >= 0)
    cout << dp[t][1] << '\n';
  else
    cout << 0 << '\n';
}
