#include <bits/stdc++.h>
using namespace std;
const int MAX = 305;
const int MAX_COST = 100005;
const int MOD = 1000000007;
long long regSum[MAX], espSum[MAX];
int a[MAX], in[MAX], out[MAX], dp[2][MAX_COST][2], n;
bool mark[MAX];
vector<int> tps;
void error() {
  cout << 0 << endl;
  exit(0);
}
void insertPath(int v) {
  if (v == -1) return;
  if (mark[v] == true) error();
  mark[v] = true;
  tps.push_back(v);
  insertPath(out[v]);
}
void sort() {
  for (int j = 1; j <= n; j++)
    if (in[j] == -1) insertPath(j);
  if (tps.size() != n) error();
}
int main() {
  int q, t;
  cin >> n >> q >> t;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    in[i] = out[i] = -1;
  }
  for (int i = 0; i < q; i++) {
    int b, c;
    cin >> b >> c;
    in[c] = b;
    out[b] = c;
  }
  sort();
  for (int i = 0; i < n; i++) {
    int v = tps[i], u = in[v];
    long long rs = 0, es = 0;
    if (u != -1) {
      rs = regSum[u];
      es = espSum[u];
    }
    regSum[v] = rs + a[v];
    espSum[v] = es + regSum[v];
  }
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= t; j++)
      for (int k = 0; k <= 1; k++) {
        int v = tps[i - 1], u = in[v];
        long long cost1, cost2;
        int newK = 1;
        if (k == 0) {
          cost1 = j - espSum[v];
          cost2 = j - (u == -1 ? 0 : espSum[u]);
        } else {
          cost1 = j - regSum[v];
          cost2 = j;
        }
        if (u == -1) newK = 0;
        dp[i % 2][j][k] = ((cost1 < 0 ? 0 : dp[i % 2][cost1][1]) +
                           (cost2 < 0 ? 0 : dp[(i - 1) % 2][cost2][newK])) %
                          MOD;
      }
  cout << dp[n % 2][t][0] << endl;
}
