#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1123;
int weight[MAXN];
int beauty[MAXN];
int aux1;
vector<int> adj[MAXN];
int comp[MAXN];
int aux = 0;
bool taken[MAXN];
int dp[MAXN][MAXN];
vector<int> group[MAXN];
void dfs(int v) {
  group[comp[v]].push_back(v);
  for (int i : adj[v]) {
    if (comp[i] == -1) {
      comp[i] = comp[v];
      dfs(i);
    }
  }
}
int rec(int pos, int w) {
  if (pos == aux) {
    return 0;
  }
  if (dp[pos][w] == -1) {
    int cur = 0;
    int totw = 0;
    int totb = 0;
    for (int i : group[pos]) {
      if (weight[i] <= w) {
        ;
        ;
        cur = max(cur, beauty[i] + rec(pos + 1, w - weight[i]));
        ;
      }
      totw += weight[i];
      totb += beauty[i];
    };
    ;
    if (totw <= w) cur = max(cur, totb + rec(pos + 1, w - totw));
    ;
    cur = max(cur, rec(pos + 1, w));
    dp[pos][w] = cur;
  };
  ;
  ;
  return dp[pos][w];
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, m, w;
  cin >> n >> m >> w;
  memset(comp, -1, sizeof(comp));
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    cin >> weight[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> beauty[i];
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (comp[i] == -1) {
      comp[i] = aux++;
      dfs(i);
    }
  }
  cout << rec(0, w) << '\n';
}
