#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 123, MAXW = 1000 + 123;
int n, m, wt, w[MAXN], b[MAXN], dp[MAXW];
vector<int> g[MAXN];
bool mark[MAXN];
vector<pair<vector<int>, pair<int, int>>> c;
void inp();
void dfs(int);
int main() {
  inp();
  for (int i = 0; i < n; i++)
    if (!mark[i]) c.push_back({{}, {0, 0}}), dfs(i);
  for (auto i : c)
    for (int j = wt; j; j--) {
      for (auto k : i.first)
        if (w[k] <= j) dp[j] = max(dp[j], dp[j - w[k]] + b[k]);
      if (j >= i.second.first)
        dp[j] = max(dp[j], dp[j - i.second.first] + i.second.second);
    }
  cout << *max_element(dp, dp + wt + 1);
  return 0;
}
void inp() {
  cin >> n >> m >> wt;
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[--u].push_back(--v), g[v].push_back(u);
  }
}
void dfs(int v) {
  mark[v] = true;
  c.back().first.push_back(v);
  c.back().second.first += w[v];
  c.back().second.second += b[v];
  for (auto u : g[v])
    if (!mark[u]) dfs(u);
}
