#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using vll = vector<LL>;
using LD = long double;
template <typename T>
void check(T& a, const T& b) {
  if (a >= b) {
    a %= b;
  }
}
template <typename T>
T gcd(T u, T v) {
  if (u == v) return u;
  if (u == 0) return v;
  if (v == 0) return u;
  if (~u & 1) {
    if (v & 1)
      return gcd(u >> 1, v);
    else
      return gcd(u >> 1, v >> 1) << 1;
  }
  if (~v & 1) return gcd(u, v >> 1);
  if (u > v) return gcd((u - v) >> 1, v);
  return gcd((v - u) >> 1, u);
}
LL mulmod(LL a, LL b, const LL& m) {
  LL q = (LL)(((LD)a * (LD)b) / (LD)m);
  LL r = a * b - q * m;
  if (r > m) r %= m;
  if (r < 0) r += m;
  return r;
}
template <typename T, typename S>
T expo(T e, S n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T powerL(T e, T n, const T& m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mulmod(x, p, m);
    p = mulmod(p, p, m);
    n >>= 1;
  }
  return x;
}
const int N = (int)1010;
const int INF = (int)-1e5;
int n, m, w[N], b[N], weight, vis[N];
int dp[N][N][3];
bool Vis[N][N][3];
vector<vi> g;
vector<int> comp[N];
int tot = 0, bf[N], wf[N];
int solve(int x, int come, int go) {
  if (come >= tot || !x) return 0;
  auto& ans = dp[x][come][go];
  auto& check = Vis[x][come][go];
  if (go == 1) {
    if (check) return ans;
    ans = 0;
    check = 1;
    if (x < wf[come]) return ans = 0;
    return ans = bf[come] + max(solve(x - wf[come], come + 1, 0),
                                solve(x - wf[come], come + 1, 1));
  } else {
    if (check) return ans;
    ans = 0;
    check = 1;
    for (int i : comp[come]) {
      if (w[i] <= x) {
        ans = max(ans, b[i] + max(solve(x - w[i], come + 1, 1),
                                  solve(x - w[i], come + 1, 0)));
      }
      ans = max(ans, max(solve(x, come + 1, 1), solve(x, come + 1, 0)));
    }
    return ans;
  }
}
void dfs(int u, int& beauty, int& wt) {
  vis[u] = true;
  beauty += b[u];
  wt += w[u];
  for (int i : g[u]) {
    if (!vis[i]) dfs(i, beauty, wt);
  }
  comp[tot].push_back(u);
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cerr.tie(NULL);
  ;
  cin >> n >> m >> weight;
  g.resize(n + 10);
  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 a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  tot = -1;
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      tot++;
      dfs(i, bf[tot], wf[tot]);
    }
  }
  tot++;
  cout << max(solve(weight, 0, 1), solve(weight, 0, 0)) << '\n';
  return 0;
}
