#include <bits/stdc++.h>
const int N = 310, D = 200010, mod = 1e9 + 7;
int n, q, t, a[N], b[N], pre[N], nex[N], dp[D];
int main() {
  scanf("%d %d %d", &n, &q, &t);
  int k = n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  while (q--) {
    int x, y;
    scanf("%d %d", &x, &y);
    pre[y] = x;
    nex[x] = y;
  }
  for (int i = 1; i <= n; i++)
    if (!nex[i]) {
      int x = i, sum = 0;
      for (int j = 0; x; j++) {
        k--, t -= j * a[x], sum += a[x], x = pre[x];
        if (t < 0) {
          printf("0");
          return 0;
        }
      }
      x = i;
      for (int j = 0; x; j++) b[x] = sum, sum -= a[x], x = pre[x];
    }
  if (k) {
    printf("0");
    return 0;
  }
  dp[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = b[i]; j <= t; j++) dp[j] = (dp[j] + dp[j - b[i]]) % mod;
  printf("%d", dp[t]);
  return 0;
}
