#include <bits/stdc++.h>
using namespace std;
const int MAX = 305, MAXT = 1e5 + 5;
const long long INF = 1e12, MOD = 1e9 + 7;
long long N, Q, T;
int A[MAX], nex[MAX], pre[MAX];
bool vis[MAX], cyc;
long long dp[MAXT];
int updA(int a) {
  if (a == -1) return 0;
  vis[a] = true;
  int old = A[a];
  if (pre[a] != -1) A[a] += A[pre[a]];
  int dep = updA(nex[a]);
  T -= dep * old;
  if (T < 0) return 0;
  return dep + 1;
}
int main() {
  cin >> N >> Q >> T;
  for (int i = 0; i < N; i++) cin >> A[i];
  memset(nex, -1, sizeof(nex));
  memset(pre, -1, sizeof(pre));
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < Q; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    nex[a] = b;
    pre[b] = a;
  }
  for (int i = 0; i < N; i++)
    if (pre[i] == -1) updA(i);
  cyc = false;
  for (int i = 0; i < N; i++)
    if (!vis[i]) cyc = true;
  if (cyc or T < 0) {
    cout << "0\n";
    return 0;
  }
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  for (int j = 0; j < N; j++) {
    for (int i = A[j]; i <= T; i++) dp[i] = (dp[i] + dp[i - A[j]]) % MOD;
  }
  cout << dp[T] % MOD << endl;
}
