#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
vector<int> adj[1234];
int n, m, w;
int ww[1234];
int bb[1234];
int vis[1234];
int www[1234];
int bbb[1234];
vector<int> wwww[1234];
vector<int> bbbb[1234];
int num;
int dp[1234][1234];
void dfs(int u) {
  vis[u] = 1;
  www[num] += ww[u];
  bbb[num] += bb[u];
  wwww[num].push_back(ww[u]);
  bbbb[num].push_back(bb[u]);
  for (int i = 0; i < adj[u].size(); i++) {
    int v = adj[u][i];
    if (vis[v] == 1) continue;
    dfs(v);
  }
}
int solve(int idx, int cur) {
  if (cur > w) return -inf;
  if (idx == num) return 0;
  int &ret = dp[idx][cur];
  if (ret != -1) return ret;
  ret = max(ret, solve(idx + 1, cur));
  for (int i = 0; i < wwww[idx].size(); i++) {
    ret = max(ret, bbbb[idx][i] + solve(idx + 1, cur + wwww[idx][i]));
  }
  ret = max(ret, bbb[idx] + solve(idx + 1, cur + www[idx]));
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) {
    cin >> ww[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> bb[i];
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  memset(vis, -1, sizeof vis);
  for (int i = 1; i <= n; i++) {
    if (vis[i] == -1) {
      dfs(i);
      num++;
    }
  }
  memset(dp, -1, sizeof dp);
  int a = solve(0, 0);
  if (a >= 0) {
    cout << a << "\n";
  } else {
    cout << 0 << "\n";
  }
  return 0;
}
