#include <bits/stdc++.h>
using namespace std;
ifstream fin("in.in");
ofstream fout("out.out");
const int N = 300 + 2, T = 1e5 + 2, MOD = 1e9 + 7;
int n, m, t, a[N], intro[N], outro[N], cnt, dp[N][T];
vector<int> c;
bool mark[N], can[N];
bool DFS(int u, int w) {
  mark[u] = true, cnt++, w += a[u];
  if (w <= t) c.push_back(w);
  if (outro[u] == -1) {
    if (w <= t) can[c.size()] = true;
    return true;
  }
  if (w > t) return false;
  if (mark[outro[u]]) return false;
  return DFS(outro[u], w);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> t;
  memset(intro, -1, sizeof intro);
  memset(outro, -1, sizeof outro);
  for (int i = 0; i < n; i++) cin >> a[i];
  while (m--) {
    int x, y;
    cin >> x >> y;
    if (outro[--x] != -1 || intro[--y] != -1) return (cout << 0), 0;
    outro[x] = y;
    intro[y] = x;
  }
  for (int i = 0; i < n; i++)
    if (intro[i] == -1)
      if (!DFS(i, 0)) return (cout << 0), 0;
  if (cnt < n) return (cout << 0), 0;
  dp[0][0] = 1, n = c.size();
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < c[i - 1]; j++)
      dp[i][j] = ((can[i]) ? (dp[i - 1][j]) : (0));
    for (int j = c[i - 1]; j <= t; j++) {
      if (can[i])
        dp[i][j] = ((dp[i - 1][j] + dp[i][j - c[i - 1]]) % MOD);
      else
        dp[i][j] = ((dp[i - 1][j - c[i - 1]] + dp[i][j - c[i - 1]]) % MOD);
    }
  }
  cout << dp[n][t] << endl;
  return 0;
}
