#include <bits/stdc++.h>
using namespace std;
int n, m, WW;
int w[1005], b[1005];
int dp[1005][1005];
vector<int> bro[10005], gr[10005];
int x, y;
int ck[1005];
int cnt;
void go(int u) {
  ck[u] = 1;
  bro[cnt].push_back(u);
  for (int i = 0; i < gr[u].size(); i++) {
    int v = gr[u][i];
    if (ck[v] == 0) go(v);
  }
}
int DP(int pos, int W) {
  if (pos == cnt) return 0;
  if (dp[pos][W] != -1) return dp[pos][W];
  int ret = 0;
  int totW = 0, totB = 0;
  ret = DP(pos + 1, W);
  for (int i = 0; i < bro[pos].size(); i++) {
    int v = bro[pos][i];
    if (W + w[v] <= WW) ret = max(ret, b[v] + DP(pos + 1, W + w[v]));
    totW += w[bro[pos][i]];
    totB += b[bro[pos][i]];
  }
  if (W + totW <= WW) ret = max(ret, totB + DP(pos + 1, W + totW));
  return dp[pos][W] = ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> WW;
  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);
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (ck[i] == 0) {
      go(i);
      cnt++;
    }
  }
  int ans = DP(0, 0);
  cout << ans;
  return 0;
}
