#include <bits/stdc++.h>
using namespace std;
const long long maxn = 300 + 10, MOD = 1000 * 1000 * 1000 + 7;
long long pre[maxn], a[maxn], nex[maxn], dp[100010][maxn], n, ccc;
vector<long long> coins;
vector<vector<long long> > tree;
bool Do(long long v, vector<long long> &T) {
  ccc++;
  if (T.size() > n) return false;
  long long temp = 0;
  if (!T.empty()) temp = coins[coins.size() - 1];
  temp += a[v];
  coins.push_back(temp);
  T.push_back(v);
  if (nex[v] != -1) return Do(nex[v], T);
  return true;
}
long long CC(long long t, long long v) {
  long long i, j, ans;
  long long temp;
  ans = 0;
  if (v >= coins.size()) return 0;
  if (dp[t][v] != -2) return dp[t][v];
  if (t - coins[v] == 0) return 1 + CC(t, v + 1);
  if (t - coins[v] > 0) ans = (ans + CC(t - coins[v], v)) % MOD;
  ans = (ans + CC(t, v + 1)) % MOD;
  return dp[t][v] = ans;
}
int main() {
  long long q, t, i, b, c, j;
  vector<long long> T;
  cin >> n >> q >> t;
  for (i = 0; i < n; i++) cin >> a[i];
  memset(pre, -1, sizeof pre);
  memset(nex, -1, sizeof nex);
  for (i = 0; i < q; i++) {
    cin >> b >> c;
    nex[b - 1] = c - 1;
    pre[c - 1] = b - 1;
  }
  ccc = 0;
  for (i = 0; i < n; i++)
    if (pre[i] == -1) {
      T.clear();
      if (!Do(i, T)) {
        cout << 0 << endl;
        return 0;
      }
      tree.push_back(T);
    }
  if (ccc != n) {
    cout << 0 << endl;
    return 0;
  }
  for (i = 0; i < 100005; i++)
    for (j = 0; j < maxn; j++) dp[i][j] = -2;
  long long init;
  init = 0ll;
  for (i = 0; i < tree.size(); i++) {
    for (j = 0; j < tree[i].size(); j++) {
      init += (a[tree[i][j]] * 1ll * ((long long)tree[i].size() - j - 1));
    }
  }
  t -= init;
  if (t < 0)
    cout << 0 << endl;
  else
    cout << (!t ? 1 : CC(t, 0)) << endl;
  return 0;
}
