#include <bits/stdc++.h>
using namespace std;
int n, m, maxw;
vector<int> g[1044];
int w[1044], b[1044];
void kbtuopen() {
  scanf("%d %d %d", &n, &m, &maxw);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
}
vector<int> c[1044];
bool was[1044];
void dfs(int v, int col) {
  was[v] = 1;
  c[col].push_back(v);
  for (int i = 0; i < (int)g[v].size(); ++i) {
    int u = g[v][i];
    if (!was[u]) dfs(u, col);
  }
}
int maxc = 0;
void Comp() {
  for (int i = 1; i <= n; ++i)
    if (!was[i]) {
      ++maxc;
      dfs(i, maxc);
    }
}
long long dp[1033][1033];
long long pref[1033];
long long ans;
void t2t() {
  for (int q = 1; q <= maxc; ++q) {
    for (int p = 0; p <= maxw; ++p) dp[q][p] = dp[q - 1][p];
    long long allB = 0;
    int allW = 0;
    for (int k = 0; k < (int)c[q].size(); ++k) {
      int v = c[q][k];
      allW += w[v];
      allB += b[v];
      for (int p = 0; p <= maxw; ++p) {
        if (p - w[v] >= 0) dp[q][p] = max(dp[q][p], pref[p - w[v]] + b[v]);
      }
    }
    for (int p = 0; p <= maxw; ++p) {
      if (p - allW >= 0) dp[q][p] = max(dp[q][p], pref[p - allW] + allB);
    }
    long long best = 0;
    for (int p = 0; p <= maxw; ++p) {
      best = max(best, dp[q][p]);
      ans = max(ans, best);
      pref[p] = best;
    }
  }
  cout << ans << "\n";
}
int main() {
  kbtuopen();
  Comp();
  t2t();
  return 0;
}
