#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 1000 + 10;
int pa[maxn], d[maxn][maxn];
int w[maxn], b[maxn];
int find(int x) { return pa[x] == x ? x : pa[x] = find(pa[x]); }
void init() {
  for (int i = 0; i < maxn; i++) pa[i] = i;
}
vector<int> mp[maxn];
int w1[maxn], b1[maxn];
int main(int argc, const char* argv[]) {
  int n, m, ww;
  while (~scanf("%d%d%d", &n, &m, &ww)) {
    init();
    for (int i = 1; i < n + 1; i++) mp[i].clear();
    for (int i = 1; i < n + 1; i++) scanf("%d", &w[i]);
    for (int i = 1; i < n + 1; i++) scanf("%d", &b[i]);
    while (m--) {
      int u, v;
      scanf("%d%d", &u, &v);
      int fu = find(u), fv = find(v);
      if (fu != fv) {
        pa[fu] = fv;
      }
    }
    for (int i = 1; i < n + 1; i++) mp[find(i)].push_back(i);
    memset(d, 0, sizeof(d));
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j <= ww; j++) d[i][j] = d[i - 1][j];
      if (mp[i].size())
        for (int j = 0; j <= ww; j++) {
          int sum1 = 0, sum2 = 0;
          for (int k = 0; k < mp[i].size(); k++) {
            sum1 += w[mp[i][k]], sum2 += b[mp[i][k]];
            if (j >= w[mp[i][k]])
              d[i][j] = max(d[i][j], d[i - 1][j - w[mp[i][k]]] + b[mp[i][k]]);
          }
          if (j >= sum1) d[i][j] = max(d[i][j], d[i - 1][j - sum1] + sum2);
        }
    }
    printf("%d\n", d[n][ww]);
  }
  return 0;
}
