#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-3;
const long long INF = (long long)(1e10);
const long long mod = (int)(1e9 + 7);
const int N = (int)(1e3);
int days_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int w[N + 1];
int b[N + 1];
int n, m, W, it;
bool vis[N + 1];
vector<int> vec[N + 1];
int sw, sb, cnt;
vector<int> route1;
void dfs(int h) {
  vis[h] = true;
  route1.push_back(h);
  sw += w[h];
  sb += b[h];
  cnt++;
  for (int h2 : vec[h]) {
    if (vis[h2]) continue;
    dfs(h2);
  }
}
int nxt[2 * N + 1];
vector<pair<int, int> > route;
void push() {
  cnt++;
  int nxt_raiz = it + cnt;
  for (int x : route1) {
    nxt[it++] = nxt_raiz;
    route.push_back({b[x], w[x]});
  }
  nxt[it++] = nxt_raiz;
  route.push_back({sb, sw});
  route1.clear();
}
bool used[2 * N + 1][N + 1];
long long memo[2 * N + 1][N + 1];
long long dp(int p, int W) {
  if (W < 0) return -INF;
  if (p == n) return 0;
  if (used[p][W]) return memo[p][W];
  used[p][W] = true;
  long long &ans = memo[p][W] = 0;
  ans = max(ans, dp(p + 1, W));
  ans = max(ans, route[p].first + dp(nxt[p], W - route[p].second));
  return ans;
}
int main() {
  cin >> n >> m >> W;
  for (int i = (1); i <= (n); i++) scanf("%d", &w[i]);
  for (int i = (1); i <= (n); i++) scanf("%d", &b[i]);
  int x, y;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  for (int i = (1); i <= (n); i++) {
    if (vis[i]) continue;
    sw = sb = cnt = 0;
    dfs(i);
    push();
  }
  n = int(route.size());
  cout << dp(0, W);
  return 0;
}
