#include <bits/stdc++.h>
using namespace std;
vector<int> adj[301];
long long a[301];
int presum = 0;
bool vis[301] = {0};
bool nk7[301] = {0};
int t;
long long dp[100005] = {0};
void dfs(int x, int p) {
  if (presum > t) return;
  if (vis[x]) {
    presum = t + 1;
    return;
  }
  vis[x] = 1;
  a[x] += a[p];
  presum += a[p];
  int omar = adj[x].size();
  for (int i = 0; i < omar; ++i) dfs(adj[x][i], x);
}
int main() {
  int n, m;
  scanf("%d%d%d", &n, &m, &t);
  for (int i = 1; i <= n; ++i) scanf("%I64d", &a[i]);
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    nk7[v] = 1;
  }
  a[0] = 0;
  for (int i = 1; i <= n; ++i)
    if (!vis[i] && !nk7[i]) dfs(i, 0);
  bool fuck = 0;
  for (int i = 1; i <= n; ++i) {
    if (!nk7[i]) fuck = 1;
    if (nk7[i] && !vis[i]) {
      fuck = 0;
      break;
    }
  }
  if (!fuck || presum > t) {
    puts("0");
    return 0;
  }
  dp[presum] = 1;
  for (int j = 1; j <= n; ++j)
    for (int i = presum + 1; i <= t; ++i) {
      if (i - a[j] >= 0) {
        dp[i] = (dp[i] + dp[i - a[j]]) % 1000000007;
      }
    }
  cout << dp[t] << endl;
}
