#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v, g;
int b1[1001], w1[1001];
int b[1001], w[1001];
bool vis[1001];
int n, x, y, m, we, c;
int dp[1001][1001];
void dfs(int i, int &sumw, int &sumb) {
  vis[i] = true;
  g[c].push_back(i);
  sumb += b[i];
  sumw += w[i];
  for (int j = 0; j < v[i].size(); j++)
    if (!vis[v[i][j]]) dfs(v[i][j], sumw, sumb);
}
int calc(int i, int a) {
  if (i == g.size()) return 0;
  if (a < 0) return -1e9;
  int &k = dp[i][a];
  if (k != -1) return k;
  k = b1[i] + calc(i + 1, a - w1[i]);
  for (int j = 0; j < g[i].size(); j++)
    k = max(k, b[g[i][j]] + calc(i + 1, a - w[g[i][j]]));
  return k = max(k, calc(i + 1, a));
}
int main() {
  cin >> n >> m >> we;
  v.resize(n + 1);
  g.resize(n + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    int sumw = 0, sumb = 0;
    dfs(i, sumw, sumb);
    b1[c] = sumb, w1[c] = sumw;
    c++;
  }
  memset(dp, -1, sizeof dp);
  cout << calc(0, we);
  return 0;
}
