#include <bits/stdc++.h>   using namespace std;   long long w[100005], mon[305], droz[305], wlazi[305], t;   long long dfs(long long co) {     long long x;     if (!droz[co]) return mon[co];     x = dfs(droz[co]);     t -= x;     mon[co] += x;     return mon[co];   }   int main() {     long long n, q, a, b, c, mod = 1000000007;     scanf( %I64d%I64d%I64d , &n, &q, &t);     for (a = 1; a <= n; a++) scanf( %I64d , &mon[a]);     while (q--) {       scanf( %I64d%I64d , &a, &b);       droz[b] = a;       wlazi[a] = 1;     }     for (a = 1; a <= n; a++) {       for (b = droz[a]; b && b != a; b = droz[b])         ;       if (b == a) {         printf( 0 n );         return 0;       }     }     for (a = 1; a <= n; a++)       if (!wlazi[a]) dfs(a);     if (t < 0) {       printf( 0 n );       return 0;     }     w[0] = 1;     for (a = 1; a <= n; a++) {       for (b = mon[a]; b <= t; b++) {         w[b] += w[b - mon[a]];         w[b] %= mod;       }     }     printf( %I64d n , w[t]);     getchar();     getchar();     return 0;   }   