#include <bits/stdc++.h>
using namespace std;
int n, k, w, kk, h[655], x, y, q = 0, ff[333][111111];
long long a[655], e[655], b[655], mins = 0, t;
vector<int> v[655];
int main() {
  cin >> n >> k >> t;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < k; i++) {
    cin >> x >> y;
    x--;
    y--;
    v[x].push_back(y);
    h[y]++;
  }
  for (int i = 0; i < n; i++)
    if (!h[i]) {
      q++;
      w = 1;
      e[0] = a[i];
      int x = i;
      for (;;) {
        if (v[x].empty()) break;
        q++;
        x = v[x][0];
        e[w++] = a[x];
      }
      for (int j = 0; j < w; j++) mins += e[j] * 1ll * (w - j - 1);
      for (int j = 0; j < w; j++) {
        b[kk++] = e[j];
        e[j + 1] += e[j];
      }
    }
  t -= mins;
  if (t < 0 || q < n) {
    puts("0");
    return 0;
  }
  ff[0][0] = 1;
  for (int i = 0; i < kk; i++)
    for (int j = 0; j <= t; j++) {
      if (j + b[i] <= t) {
        ff[i][j + b[i]] = (ff[i][j + b[i]] + ff[i][j]);
        if (ff[i][j + b[i]] >= 1000000007) ff[i][j + b[i]] -= 1000000007;
      }
      ff[i + 1][j] = (ff[i + 1][j] + ff[i][j]);
      if (ff[i + 1][j] >= 1000000007) ff[i + 1][j] -= 1000000007;
    }
  cout << ff[kk][t] << endl;
  return 0;
}
