#include <bits/stdc++.h>
const long long N_POINTS = 100005;
const long long N_COINS = 308;
using namespace std;
long long coin_count[N_COINS];
long long ori_val[N_COINS];
long long value[N_COINS];
long long greater_than[N_COINS];
long long is_leaf[N_COINS];
long long type[N_POINTS];
long long at_least[N_COINS];
struct uf {
  long long body[N_POINTS];
  void init(long long n_point) {
    for (long long i = 0; i < n_point; i++) {
      body[i] = i;
    }
  }
  long long find_root(long long node) {
    long long grand_pa;
    long long papa;
    papa = body[node];
    if (papa == node) {
      return node;
    }
    grand_pa = body[papa];
    if (grand_pa != papa) {
      body[node] = grand_pa;
    }
    node = papa;
    return find_root(papa);
  }
  long long u(long long a, long long b) {
    a = find_root(a);
    b = find_root(b);
    if (a == b) {
      return 0;
    }
    body[a] = b;
    return 1;
  }
  long long f(long long a, long long b) { return a == b; }
};
uf my_uf;
long long n_coin, total, n_restriction;
long long from, to;
void init() {
  for (long long i = 0; i < n_coin; i++) {
    is_leaf[i] = 1;
    greater_than[i] = -1;
  }
  for (long long i = 0; i <= total; i++) {
    type[i] = 0;
  }
  type[0] = 1;
}
void die() {
  cout << 0;
  exit(0);
}
long long refresh_value(long long current_point, long long mn = 0) {
  if (current_point == -1) {
    return false;
  }
  if (refresh_value(greater_than[current_point], mn + 1)) {
    value[current_point] += value[greater_than[current_point]];
    if (value[current_point] > N_POINTS) {
      value[current_point] = N_POINTS;
    }
  }
  at_least[current_point] = mn;
  return true;
}
int main() {
  cin >> n_coin >> n_restriction >> total;
  my_uf.init(n_coin);
  init();
  for (long long i = 0; i < n_coin; i++) {
    cin >> value[i];
  }
  for (long long i = 0; i < n_restriction; i++) {
    cin >> from >> to;
    from--, to--;
    if (!my_uf.u(from, to)) {
      die();
    };
    is_leaf[from] = 0;
    greater_than[to] = from;
  }
  for (long long i = 0; i < n_coin; i++) {
    ori_val[i] = value[i];
  }
  for (long long i = 0; i < n_coin; i++) {
    if (is_leaf[i]) {
      refresh_value(i);
    }
  }
  for (long long i = 0; i < n_coin; i++) {
    total -= ori_val[i] * at_least[i];
    if (total < 0) {
      die();
    }
  }
  for (long long i = 0; i < n_coin; i++) {
    for (long long j = value[i]; j <= total; j++) {
      type[j] += type[j - value[i]];
      type[j] %= 1000000007;
    }
  }
  cout << type[total];
}
