#include <bits/stdc++.h>
using namespace std;
int t, cnt, cal, tot, n, q, val[310], que[310], f[100010], fat[310];
bool tail[310];
void ins(int pos) {
  if (pos != 0) {
    t -= val[pos] * cnt;
    if (t < 0) return;
    cnt++;
    ins(fat[pos]);
    cal += val[pos];
    tot++;
    que[tot] = cal;
  }
}
int main() {
  cin >> n >> q >> t;
  int i;
  for (i = 1; i <= n; i++) scanf("%d", &val[i]);
  memset(fat, 0, sizeof(fat));
  memset(tail, true, sizeof(tail));
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    fat[y] = x;
    if (fat[x] == y) t = -1;
    tail[x] = false;
  }
  tot = 0;
  for (i = 1; i <= n; i++)
    if (tail[i]) {
      cnt = 0;
      cal = 0;
      ins(i);
    }
  memset(f, 0, sizeof(f));
  int j;
  f[0] = 1;
  for (i = 1; i <= tot; i++)
    for (j = que[i]; j <= t; j++) f[j] = (f[j] + f[j - que[i]]) % 1000000007;
  if (t < 0)
    cout << 0 << endl;
  else
    cout << f[t] << endl;
}
