#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
const int maxs = 100010;
int dp[maxs];
const int maxn = 310;
int indeg[maxn];
int outdeg[maxn];
int a[maxn];
int To[maxn];
int u[maxn];
const int mod = 1000000007;
int main() {
  int n, q, t;
  scanf("%d%d%d", &n, &q, &t);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  memset(To, -1, sizeof(To));
  for (int iter = 0; iter < q; ++iter) {
    int fr, to;
    scanf("%d%d", &fr, &to);
    --fr, --to;
    outdeg[fr]++;
    indeg[to]++;
    To[fr] = to;
  }
  long long rem = 0;
  for (int i = 0; i < n; ++i) {
    if (indeg[i] == 0) {
      int cursum = 0;
      int cur = i;
      vector<int> vv;
      while (cur != -1) {
        u[cur] = 1;
        vv.push_back(a[cur]);
        cursum += a[cur];
        a[cur] = cursum;
        cur = To[cur];
      }
      reverse(vv.begin(), vv.end());
      for (int j = 0; j < int((vv).size()); ++j) rem += vv[j] * (long long)j;
    }
  }
  for (int i = 0; i < n; ++i)
    if (!u[i]) printf("0\n"), exit(0);
  if (t < rem) printf("0\n"), exit(0);
  t -= rem;
  dp[0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < t + 1; ++j) {
      if (!dp[j]) continue;
      int to = j + a[i];
      if (to <= t) {
        dp[to] = dp[to] + dp[j];
        if (dp[to] >= mod) dp[to] -= mod;
      }
    }
  }
  printf("%d\n", dp[t]);
  return 0;
}
