#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int f[100000 + 5][2];
int g[100000 + 5][2];
int c[333][333];
int out_deg[333], a[333], cost[333];
int n, t, q;
int main() {
  scanf("%d %d %d", &n, &q, &t);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cost[i] = a[i];
  }
  for (int i = 1; i <= q; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    out_deg[u]++;
    c[u][v] = 1;
  }
  for (int i = 1; i <= n; i++) c[i][i] = 1;
  for (int k = 1; k <= n; k++)
    for (int u = 1; u <= n; u++)
      for (int v = 1; v <= n; v++) c[u][v] |= (c[u][k] & c[k][v]);
  for (int u = 1; u <= n; u++)
    for (int v = 1; v <= n; v++)
      if (u != v && c[u][v] && c[v][u]) {
        printf("0");
        return 0;
      }
  for (int v = 1; v <= n; v++)
    for (int u = 1; u <= n; u++)
      if (u != v && c[u][v]) cost[v] += a[u];
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= t; j++)
      for (int k = 0; k < 2; k++) {
        g[j][k] = f[j][k];
        f[j][k] = 0;
      }
    for (int j = 0; j <= t; j++)
      for (int k = 0; k < 2; k++) {
        if (j + cost[i] <= t)
          g[j + cost[i]][1] = (g[j + cost[i]][1] + g[j][k]) % mod;
        if ((k == 1) || (k == 0 && out_deg[i] == 0))
          f[j][0] = (f[j][0] + g[j][k]) % mod;
      }
  }
  int ans = g[t][1];
  if (out_deg[n] == 0) ans = (ans + g[t][0]) % mod;
  printf("%d", ans);
}
