#include <bits/stdc++.h>
using namespace std;
const int LG = 30;
const int N = 1005;
int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
vector<int> g[N];
vector<pair<int, int> > s[N];
int w[N];
int b[N];
int dp1[N][1003];
int dp2[N][1003];
int vis[N];
void dfs(int i, int cnt) {
  s[cnt].push_back(make_pair(w[i], i));
  int sz = g[i].size();
  for (int j = 0; j <= sz - 1; j++) {
    int x = g[i][j];
    if (vis[x]) continue;
    vis[x] = 1;
    dfs(x, cnt);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, W;
  cin >> n >> m >> W;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      vis[i] = 1;
      dfs(i, cnt);
      cnt++;
    }
  }
  int ln = cnt;
  for (int i = 0; i < ln; i++) {
    int s1 = 0, s2 = 0;
    int sz = s[i].size();
    for (int j = 0; j <= sz - 1; j++) {
      int wt = s[i][j].first;
      s1 = s1 + wt;
      int val = b[s[i][j].second];
      s2 = s2 + val;
      dp1[i][wt] = max(val, dp1[i][wt]);
    }
    if (s1 <= 1000) dp1[i][s1] = s2;
    for (int wt = 1; wt <= W; wt++) {
      dp1[i][wt] = max(dp1[i][wt], dp1[i][wt - 1]);
    }
  }
  for (int wt = 1; wt <= W; wt++) {
    dp2[0][wt] = dp1[0][wt];
  }
  for (int i = 1; i < ln; i++) {
    for (int wt = 0; wt <= W; wt++) {
      for (int j = 0; j <= wt; j++) {
        dp2[i][wt] = max(dp2[i][wt], dp2[i - 1][j] + dp1[i][wt - j]);
      }
    }
  }
  cout << dp2[ln - 1][W];
  return 0;
}
