#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long power(long long a, long long b, long long m = 1000000007) {
  long long answer = 1;
  while (b) {
    if (b & 1) answer = (answer * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return answer;
}
using namespace std;
void ctrl() { cout << "Control" << endl; }
long long make_num(string p) {
  stringstream geek(p);
  long long x = 0;
  geek >> x;
  return x;
}
string make_str(long long x) {
  ostringstream str1;
  str1 << x;
  string geek = str1.str();
  return geek;
}
long long n, m, w;
long long W[1000 + 5], B[1000 + 5];
long long dp[1000 + 5][1000 + 5];
vector<vector<long long> > v;
vector<long long> g[1000 + 5];
long long recur(long long id, long long wt) {
  if (wt > w) return -LL_INF;
  if (id == v.size()) {
    return 0;
  }
  if (dp[id][wt] != -1) return dp[id][wt];
  long long ans = recur(id + 1, wt), cost = 0, b = 0;
  for (auto it : v[id]) {
    ans = max(ans, B[it] + recur(id + 1, wt + W[it]));
    cost += W[it];
    b += B[it];
  }
  ans = max(ans, b + recur(id + 1, wt + cost));
  return dp[id][wt] = ans;
}
bool vis[1000 + 5];
vector<long long> comp;
void dfs(long long x) {
  vis[x] = 1;
  comp.push_back(x);
  for (auto it : g[x]) {
    if (!vis[it]) dfs(it);
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  cin >> n >> m >> w;
  for (long long i = 0; i < n; i++) cin >> W[i];
  for (long long i = 0; i < n; i++) cin >> B[i];
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (long long i = 0; i < n; i++) {
    if (!vis[i]) {
      comp.clear();
      dfs(i);
      v.push_back(comp);
    }
  }
  memset(dp, -1, sizeof(dp));
  cout << recur(0, 0);
  return 0;
}
