#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int n, q, t;
const int SIZE = 305;
int vis[SIZE], cst[SIZE];
int par[SIZE], child[SIZE];
int memo[SIZE][100005];
int DP(int idx, int rem) {
  if (rem == 0) return 1;
  if (rem < 0 || idx > n) return 0;
  int& m = memo[idx][rem];
  if (m != -1) return m;
  m = DP(idx, rem - cst[idx]);
  m += DP(idx + 1, rem);
  m %= mod;
  return m;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> q >> t;
  for (int i = 1; i <= n; i += 1) cin >> cst[i];
  int a, b;
  while (q--) {
    cin >> a >> b;
    child[a] = b;
    par[b] = a;
  }
  for (int i = 1; i <= n; i += 1) {
    if (vis[i]) continue;
    deque<int> q;
    int j;
    for (j = i; j && !vis[j]; j = child[j]) {
      q.push_back(j);
      vis[j] = 1;
    }
    if (vis[j]) {
      cout << 0;
      return 0;
    }
    for (j = par[i]; j && !vis[j]; j = par[j]) {
      q.push_front(j);
      vis[j] = 1;
    }
    if (vis[j]) {
      cout << 0;
      return 0;
    }
    for (j = 0; j < ((int)(q).size()); j++) {
      t -= (((int)(q).size()) - j - 1) * cst[q[j]];
      if (t < 0) {
        cout << 0;
        return 0;
      }
      if (j) cst[q[j]] += cst[q[j - 1]];
    }
  }
  memset((memo), (-1), sizeof(memo));
  cout << DP(1, t) << endl;
  return 0;
}
