#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int nmax = 1e5 + 5;
const int mod = 1e9 + 7;
const long double eps = 1e-9;
const long double PI = acos(-1.0);
const int inf = 1e9;
const long double big = 2e18;
int b[1005];
int a[1005];
vector<int> g[1005];
vector<pair<int, int> > v;
vector<vector<pair<int, int> > > d;
int used[1005];
int dp[1005][1005];
int cntw;
int cntb;
void dfs(int x) {
  used[x] = 1;
  v.push_back(make_pair(a[x], b[x]));
  cntb += b[x];
  cntw += a[x];
  for (auto to : g[x]) {
    if (!used[to]) dfs(to);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  long long w;
  cin >> w;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int cmp = 0;
  for (int i = 0; i < n; ++i) {
    if (!used[i]) {
      v.clear();
      cntw = 0;
      cntb = 0;
      dfs(i);
      v.push_back(make_pair(cntw, cntb));
      d.push_back(v);
      cmp++;
    }
  }
  memset(dp, -1, sizeof(dp));
  int ans = 0;
  dp[0][0] = 0;
  for (int i = 0; i < cmp; ++i) {
    for (int j = 0; j <= w; ++j) {
      if (dp[i][j] == -1) continue;
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      for (int k = 0; k < d[i].size(); ++k) {
        if (d[i][k].first + j <= w) {
          dp[i + 1][j + d[i][k].first] =
              max(dp[i + 1][j + d[i][k].first], dp[i][j] + d[i][k].second);
        }
      }
    }
  }
  for (int i = 0; i <= w; ++i) ans = max(ans, dp[cmp][i]);
  cout << ans << '\n';
  return 0;
}
