#include <bits/stdc++.h>
using namespace std;
const double pi =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
int dp[100010], t, a[310], b[310];
vector<int> g[310], chain[310];
bool done[310], wchodzi[310];
void go(int akt, int beg) {
  done[akt] = 1;
  chain[beg].push_back(akt);
  if (!g[akt].empty()) go(g[akt].front(), beg);
}
void go1(int pos) {
  for (int i = (1); i < (chain[pos].size()); ++i) {
    t -= a[chain[pos][i - 1]] * (chain[pos].size() - i);
    if (t < 0) return;
    b[chain[pos][i]] += b[chain[pos][i - 1]];
  }
}
int main() {
  int n, q;
  scanf("%d%d%d", &n, &q, &t);
  for (int i = 0; i < (n); ++i) scanf("%d", &a[i]);
  for (int i = 0; i < (q); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    g[a].push_back(b);
    wchodzi[b] = 1;
  }
  for (int i = 0; i < (n); ++i)
    if (!done[i] && !wchodzi[i]) go(i, i);
  for (int i = 0; i < (n); ++i)
    if (!done[i]) {
      printf("0\n");
      return 0;
    }
  for (int i = 0; i < (n); ++i) b[i] = a[i];
  for (int i = 0; i < (n); ++i) go1(i);
  if (t < 0) {
    printf("0\n");
    return 0;
  }
  dp[0] = 1;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (t - b[i] + 1); ++j)
      dp[j + b[i]] = (dp[j + b[i]] + dp[j]) % 1000000007;
  printf("%d\n", dp[t]);
  return 0;
}
