#include <bits/stdc++.h>
using namespace std;
const long long N = 305;
const long long M = 1e5 + 5;
const long long MOD = 1e9 + 7;
long long n, q, t;
long long a[N], cost[N], lvl[N], cache[N][M], vis[N];
vector<long long> g[N], rg[N];
bool findLoop(long long v) {
  if (vis[v] == 1) return 1;
  if (vis[v] == 2) return 0;
  vis[v] = 1;
  for (auto &it : g[v]) {
    if (findLoop(it)) return 1;
  }
  vis[v] = 2;
  return 0;
}
bool checkLoop() {
  fill(vis + 1, vis + n + 1, 0);
  for (long long i = 1; i <= n; i++) {
    if (!vis[i] && findLoop(i)) return 1;
  }
  return 0;
}
long long dfs(long long x) {
  long long &ans = cost[x];
  if (ans != -1) return ans;
  ans = a[x];
  long long level = 0;
  for (auto &it : g[x]) ans += dfs(it);
  return ans;
}
long long dfs2(long long x) {
  long long &ans = lvl[x];
  if (ans != -1) return ans;
  ans = 0;
  for (auto &it : rg[x]) ans = 1 + dfs2(it);
  t -= ans * a[x];
  return ans;
}
long long dp(long long idx, long long val) {
  if (val < 0) return 0;
  if (val == 0) return 1;
  if (idx == n + 1) return 0;
  long long &ans = cache[idx][val];
  if (ans != -1) return ans;
  ans = dp(idx + 1, val) + dp(idx, val - cost[idx]);
  ans %= MOD;
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  memset(cost, -1, sizeof(cost));
  memset(cache, -1, sizeof(cache));
  memset(lvl, -1, sizeof(lvl));
  cin >> n >> q >> t;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= q; i++) {
    long long b, c;
    cin >> b >> c;
    g[c].push_back(b);
    rg[b].push_back(c);
  }
  if (checkLoop()) {
    cout << 0;
    return 0;
  }
  for (long long i = 1; i <= n; i++) cost[i] = dfs(i);
  for (long long i = 1; i <= n; i++) dfs2(i);
  long long ans = dp(1, t);
  cout << ans;
  return 0;
}
