#include <bits/stdc++.h>
using namespace std;
int b[1005], w[1005];
vector<int> v[1005];
bool seen[1005];
vector<vector<pair<int, int> > > c;
vector<pair<int, int> > tmp;
long long int wt, bt;
void dfs(int s) {
  seen[s] = true;
  tmp.push_back(make_pair(b[s], w[s]));
  wt += w[s];
  bt += b[s];
  for (int i = 0; i < v[s].size(); i++) {
    if (!seen[v[s][i]]) {
      dfs(v[s][i]);
    }
  }
}
long long int dp[1003][1003];
long long int cool(int i, int g) {
  if (i >= c.size()) return 0;
  long long int res = 0;
  if (dp[i][g] != -1) return dp[i][g];
  for (int j = 0; j < c[i].size(); j++) {
    if (c[i][j].second <= g) {
      res = max(res, c[i][j].first + cool(i + 1, g - c[i][j].second));
    }
  }
  res = max(res, cool(i + 1, g));
  dp[i][g] = res;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, g;
  cin >> n >> m >> g;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (!seen[i]) {
      wt = 0;
      bt = 0;
      dfs(i);
      tmp.push_back(make_pair(bt, wt));
      c.push_back(tmp);
      tmp.clear();
    }
  }
  long long int res = cool(0, g);
  cout << res << '\n';
  ;
  return 0;
}
