#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 3e2 + 10;
const long long MAXT = 1e5 + 10;
const long long Mod = 1e9 + 7;
long long dp[MAXN][MAXT];
long long a[MAXN];
long long b[MAXN];
long long f[MAXN];
bool e[MAXN];
bool check[MAXN];
long long t = 1;
void dfs(long long v) {
  if (v == 0) {
    return;
  }
  check[v] = true;
  b[t++] = v;
  dfs(f[v]);
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  long long n, q, t, sum = 0;
  cin >> n >> q >> t;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < q; i++) {
    long long v, u;
    cin >> v >> u;
    f[v] = u;
    e[u] = true;
  }
  for (long long i = 1; i <= n; i++) {
    if (!e[i]) {
      dfs(i);
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (!check[i]) {
      cout << 0;
      return 0;
    }
  }
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    if (!e[b[i]]) {
      sum = 0;
    }
    sum += a[b[i]];
    for (long long j = 0; j < MAXT; j++) {
      dp[i][j] = (j >= sum - a[b[i]] ? dp[i - 1][j - sum + a[b[i]]] : 0) +
                 (j >= sum ? dp[i][j - sum] : 0);
      dp[i][j] %= Mod;
    }
  }
  cout << dp[n][t];
}
