#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 300 + 20;
const long long MAX = 1e5 + 20;
const long long MOD = 1e9 + 7;
long long n, m, tot;
long long vec[MAXN];
vector<long long> adj[MAXN];
short mark[MAXN];
vector<long long> st;
bool fail;
long long gec[MAXN], ans[MAX], sz;
vector<long long> sec;
void dfs(long long v) {
  if (mark[v] == 1) fail = 1;
  if (mark[v]) return;
  mark[v] = 1;
  for (long long u : adj[v]) dfs(u);
  mark[v] = 2;
  st.push_back(v);
}
void get(long long v) {
  mark[v] = 1;
  for (long long u : adj[v]) get(u);
  sec.push_back(v);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> tot;
  for (long long i = 0; i < n; i++) cin >> vec[i];
  while (m--) {
    long long a, b;
    cin >> a >> b;
    a--, b--;
    adj[b].push_back(a);
  }
  for (long long i = 0; i < n; i++)
    if (mark[i] == 0) dfs(i);
  if (fail) {
    cout << 0 << endl;
    return 0;
  }
  memset(mark, 0, sizeof(mark));
  reverse(st.begin(), st.end());
  for (long long v : st)
    if (mark[v] == 0) {
      get(v);
      long long sum = 0, temp = 0;
      for (long long i = 0; i < sec.size(); i++) {
        temp += sum;
        sum += vec[sec[i]];
        gec[sz++] = sum;
      }
      tot -= temp;
      sec.clear();
    }
  if (tot < 0) {
    cout << 0 << endl;
    return 0;
  }
  ans[0] = 1;
  for (long long i = 0; i < sz; i++)
    for (long long j = 0; j < MAX; j++)
      if (j >= gec[i]) ans[j] = (ans[j] + ans[j - gec[i]]) % MOD;
  cout << ans[tot] << endl;
  return 0;
}
