#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17;
const int MOD = 1000000007;
vector<vector<int> > g(310, vector<int>()), gr(310, vector<int>());
vector<long long> coincost(310, 0), independentcoins;
vector<bool> used(310, false);
long long n, q, t;
void check_cycles(int v) {
  used[v] = true;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (used[to]) {
      cout << "0";
      exit(0);
    } else {
      check_cycles(to);
    }
  }
}
void rehearse(int v, long long sum) {
  used[v] = 0;
  independentcoins.push_back(sum + coincost[v]);
  if (g[v].size() != 0) t -= sum + coincost[v];
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    rehearse(to, sum + coincost[v]);
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> q >> t;
  for (int i = 0; i < n; ++i) {
    cin >> coincost[i];
  }
  for (int i = 0; i < q; ++i) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
    gr[y].push_back(x);
  }
  for (int i = 0; i < n; ++i) {
    if (!used[i]) check_cycles(i);
    for (int i = 0; i < n; ++i) {
      used[i] = false;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (!used[i] && gr[i].size() == 0) rehearse(i, 0);
  }
  if (t < 0) {
    cout << 0;
    exit(0);
  }
  vector<vector<long long> > dp(n + 1, vector<long long>(t + 1, 0));
  for (int i = 0; i <= n; ++i) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    int a = independentcoins[i - 1];
    vector<vector<long long> > pref(a, vector<long long>());
    for (int ost = 0; ost < a; ++ost) {
      pref[ost].push_back(dp[i - 1][ost]);
      for (int step = ost + a; step <= t; step += a) {
        pref[ost].push_back((pref[ost].back() + dp[i - 1][step]) % MOD);
      }
    }
    for (int j = 1; j <= t; ++j) {
      if (j >= a) {
        dp[i][j] = pref[j % a][j / a];
      } else
        dp[i][j] = dp[i - 1][j];
    }
  }
  cout << dp[n][t];
}
