#include <bits/stdc++.h>
using namespace std;
int RD(int &x) { return scanf("%d", &x); }
int RD(long long &x) { return scanf("%I64d", &x); }
int RD(unsigned int &x) { return scanf("%u", &x); }
int RD(double &x) { return scanf("%lf", &x); }
int RD(int &x, int &y) { return scanf("%d%d", &x, &y); }
int RD(long long &x, long long &y) { return scanf("%I64d%I64d", &x, &y); }
int RD(unsigned int &x, unsigned int &y) { return scanf("%u%u", &x, &y); }
int RD(double &x, double &y) { return scanf("%lf%lf", &x, &y); }
int RD(int &x, int &y, int &z) { return scanf("%d%d%d", &x, &y, &z); }
int RD(long long &x, long long &y, long long &z) {
  return scanf("%I64d%I64d%I64d", &x, &y, &z);
}
int RD(unsigned int &x, unsigned int &y, unsigned int &z) {
  return scanf("%u%u%u", &x, &y, &z);
}
int RD(double &x, double &y, double &z) {
  return scanf("%lf%lf%lf", &x, &y, &z);
}
int RD(char &x) { return x = getchar(); }
int RD(char *s) { return scanf("%s", s); }
void RD(string &s) { cin >> s; }
void PR(int x) { printf("%d\n", x); }
void PR(long long x) { printf("%I64d\n", x); }
void PR(unsigned int x) { printf("%u\n", x); }
void PR(double x) { printf("%.6lf\n", x); }
void PR(char x) { printf("%c\n", x); }
void PR(char *x) { printf("%s\n", x); }
void PR(string x) { cout << x << endl; }
const int maxn = 400;
const int maxm = 1e5 + 100;
long long n, q, t, acct;
long long a[maxn], mat[maxn][maxn], vis[maxn], d[maxm], deg[maxn];
vector<long long> st;
long long dfs(int u, long long sum) {
  if (vis[u]) return -1;
  vis[u] = 1;
  st.push_back(sum + a[u]);
  int flg = 0;
  for (int v = 1; v <= n; v++) {
    if (mat[u][v]) {
      if (dfs(v, sum + a[u]) == -1) return -1;
      flg = 1;
    }
  }
  if (flg) acct += sum + a[u];
  return 1;
}
long long solve() {
  sort(st.begin(), st.end());
  int sz = st.size();
  memset(d, 0, sizeof(d));
  ;
  d[0] = 1;
  t -= acct;
  if (t < 0) return 0;
  for (int k = 0; k <= sz - 1; k++) {
    for (int w = 1; w <= t; w++) {
      if (w - st[k] >= 0) {
        d[w] = (d[w] + d[w - st[k]] % (1000000000 + 7)) % (1000000000 + 7);
      }
    }
  }
  return d[t];
}
int main() {
  while (RD(n, q, t) == 3) {
    acct = 0;
    memset(mat, 0, sizeof(mat));
    ;
    memset(deg, 0, sizeof(deg));
    ;
    for (int i = 1; i <= n; i++) RD(a[i]);
    for (int i = 1; i <= q; i++) {
      int b, c;
      RD(b, c);
      mat[b][c] = 1;
      deg[c]++;
    }
    memset(vis, 0, sizeof(vis));
    ;
    st.clear();
    int flg = 1;
    for (int i = 1; i <= n; i++) {
      if (!vis[i] && deg[i] == 0) {
        int ret = dfs(i, 0);
        if (ret == -1) flg = 0;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (!vis[i]) {
        int ret = dfs(i, 0);
        if (ret == -1) flg = 0;
      }
    }
    if (!flg) {
      printf("0\n");
    } else {
      printf("%I64d\n", solve());
    }
  }
  return 0;
}
