#include <bits/stdc++.h>
using namespace std;
long long dp[1005][1005];
vector<int> v[1005], vec[1005];
long long weight[1005], weighttotal[1005], b[1005], btotal[1005];
int vis[1005];
void dfs(int node, int val) {
  if (vis[node] != 0) return;
  vis[node] = val;
  vec[val].push_back(node);
  for (int i = 0; i < v[node].size(); i++) {
    if (vis[v[node][i]] != 0) continue;
    dfs(v[node][i], val);
  }
}
int main() {
  int n, m, w, i, j, k, x, y, val;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &w);
  for (i = 1; i <= n; i++) scanf("%d", &weight[i]);
  for (i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (i = 1; i <= m; i++) {
    scanf("%d", &x);
    scanf("%d", &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  x = 1;
  for (i = 1; i <= n; i++) {
    if (vis[i]) continue;
    dfs(i, x);
    x++;
  }
  for (i = 1; i < x; i++) {
    for (j = 0; j < vec[i].size(); j++) {
      weighttotal[i] += weight[vec[i][j]];
      btotal[i] += b[vec[i][j]];
    }
  }
  for (i = 0; i < x; i++) dp[i][0] = 0;
  for (i = 0; i <= w; i++) dp[0][w] = 0;
  for (i = 1; i < x; i++) {
    for (j = 1; j <= w; j++) {
      if (j - weighttotal[i] >= 0)
        dp[i][j] = max(dp[i][j], max(dp[i - 1][j - weighttotal[i]] + btotal[i],
                                     dp[i - 1][j]));
      else
        dp[i][j] = max(dp[i][j], dp[i - 1][j]);
      for (k = 0; k < vec[i].size(); k++) {
        if (j - weight[vec[i][k]] >= 0)
          dp[i][j] =
              max(dp[i][j], max(dp[i - 1][j - weight[vec[i][k]]] + b[vec[i][k]],
                                dp[i - 1][j]));
        else
          dp[i][j] = max(dp[i][j], dp[i - 1][j]);
      }
    }
  }
  cout << dp[x - 1][w] << endl;
  return 0;
}
