#include <bits/stdc++.h>
using namespace std;
long long oo = 10000000000000;
bool vis[1500];
vector<int> adjlist[1500];
int WW[1500];
int BB[1500];
int aloneB[1500];
long long groubB[1500];
int aloneW[1500];
long long groubW[1500];
int nextpos[1500];
vector<int> G;
void dfs(int x) {
  for (int i = 0; i < (int)adjlist[x].size(); i++)
    if (!vis[adjlist[x][i]]) {
      vis[adjlist[x][i]] = 1;
      dfs(adjlist[x][i]);
      G.push_back(adjlist[x][i]);
    }
}
int n;
long long dp[1100][1100];
long long go(long long pos, long long W) {
  if (W < 0) return -oo;
  if (pos > n) return 0;
  if (dp[pos][W] != -1) return dp[pos][W];
  long long res1 = go(pos + 1, W);
  long long res2 = go(nextpos[pos], W - groubW[pos]) + groubB[pos];
  long long res3 = go(nextpos[pos], W - aloneW[pos]) + aloneB[pos];
  long long res = max(res1, res2);
  res = max(res, res3);
  return dp[pos][W] = res;
}
int main() {
  memset(dp, -1, sizeof(dp));
  int m, W;
  cin >> n >> m >> W;
  for (int i = 1; i <= n; i++) scanf("%d", &WW[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &BB[i]);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    adjlist[u].push_back(v);
    adjlist[v].push_back(u);
  }
  memset(vis, 0, sizeof(vis));
  int mahjous = 1;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    G.clear();
    G.push_back(i);
    vis[i] = 1;
    dfs(i);
    long long GHW = 0, GHB = 0;
    for (int j = 0; j < (int)G.size(); j++) {
      GHB += BB[G[j]];
      GHW += WW[G[j]];
    }
    int firstpos = mahjous;
    mahjous += (int)G.size();
    for (int j = 0; j < (int)G.size(); j++) {
      aloneB[j + firstpos] = BB[G[j]];
      aloneW[j + firstpos] = WW[G[j]];
      groubB[j + firstpos] = GHB;
      groubW[j + firstpos] = GHW;
      nextpos[j + firstpos] = mahjous;
    }
  }
  cout << go(1, W) << endl;
  return 0;
}
