#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1001];
int visited[1001];
int dp[1001][1001];
int b[1001], w[1001];
int bb[1001];
int ww[1001];
vector<int> bbb[1001];
vector<int> www[1001];
int cnt = 1;
void dfs(int v) {
  visited[v] = 1;
  bb[cnt] += b[v];
  ww[cnt] += w[v];
  bbb[cnt].push_back(b[v]);
  www[cnt].push_back(w[v]);
  for (int i = 0; i < adj[v].size(); i++)
    if (!visited[adj[v][i]]) dfs(adj[v][i]);
}
int main() {
  int n, m, wm;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &wm);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  while (m--) {
    int u, v;
    scanf("%d", &u);
    scanf("%d", &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      dfs(i);
      cnt++;
    }
  }
  cnt--;
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; j <= wm; j++) {
      dp[i][j] = dp[i - 1][j];
      for (int k = 0; k < www[i].size(); k++)
        if (www[i][k] <= j)
          dp[i][j] = max(dp[i][j], dp[i - 1][j - www[i][k]] + bbb[i][k]);
      if (j >= ww[i]) dp[i][j] = max(dp[i][j], dp[i - 1][j - ww[i]] + bb[i]);
    }
  }
  printf("%d\n", dp[cnt][wm]);
}
