#include <bits/stdc++.h>
using namespace std;
vector<int> G[1001];
vector<int> groups[1001];
bool V[1001];
int Gr[1001];
int W[1001];
int B[1001];
int Wg[1001];
int Bg[1001];
int Dp[1001][1001];
void dfs(int v, int g) {
  if (V[v]) return;
  V[v] = true;
  Gr[v] = g;
  groups[g].push_back(v);
  Wg[g] += W[v];
  Bg[g] += B[v];
  for (auto x : G[v]) dfs(x, g);
}
void calc(int group, int w) {
  for (int i = w; i >= 0; --i) Dp[group][i] = Dp[group - 1][i];
  for (auto h : groups[group]) {
    for (int i = w; i >= W[h]; --i)
      Dp[group][i] = max(Dp[group][i], Dp[group - 1][i - W[h]] + B[h]);
  }
  for (int i = w; i >= Wg[group]; --i)
    Dp[group][i] = max(Dp[group][i], Dp[group - 1][i - Wg[group]] + Bg[group]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, w, a, b;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; ++i) cin >> W[i];
  for (int i = 1; i <= n; ++i) cin >> B[i];
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  int g = 1;
  for (int i = 1; i <= n; ++i)
    if (!V[i]) dfs(i, g++);
  for (int i = 1; i < g; ++i) calc(i, w);
  cout << Dp[g - 1][w];
  return 0;
}
