#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("-Ofast", "-funroll-all-loops", "-ffast-math")
using namespace std;
using LL = long long;
constexpr LL mod = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long ex_gcd(long long a, long long b, long long &x, long long &y) {
  if (!b) {
    x = 1;
    y = 0;
    return a;
  }
  long long ret = ex_gcd(b, a % b, y, x);
  y -= a / b * x;
  return ret;
}
LL bin(LL x, LL n, LL MOD) {
  LL ret = MOD != 1;
  for (x %= MOD; n; n >>= 1, x = x * x % MOD)
    if (n & 1) ret = ret * x % MOD;
  return ret;
}
LL norm(LL x) { return x >= mod ? (x - mod) : x; }
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
inline long long get_inv(long long a) {
  long long x, y;
  ex_gcd(a, mod, x, y);
  return norm(x + mod);
}
template <class T>
inline void umin(T &x, T y) {
  x = x > y ? y : x;
}
template <class T>
inline void umax(T &x, T y) {
  x = x < y ? y : x;
}
template <class T>
inline void dec(T &x, T y) {
  x -= y;
  if (x < 0) x += mod;
}
template <class T>
inline void add(T &x, T y) {
  x += y;
  if (x >= mod) x -= mod;
}
const double PI = acos(-1.0);
constexpr LL INF = 0x3f3f3f3f;
constexpr long long linf = 0x3f3f3f3f3f3f3f3f;
constexpr unsigned long long base = 2333, P_1 = 19260817, P_2 = 999998639;
constexpr LL maxn = 1e6 + 10;
LL fa[maxn];
void init(LL n) {
  for (LL i = 1; i < n; i++) fa[i] = i;
}
LL find(LL x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
void Union(LL x, LL y) {
  x = find(x), y = find(y);
  if (x == y) return;
  fa[x] = y;
}
LL n, m, v, w[maxn], b[maxn], dp[maxn], pd[maxn];
int32_t main() {
  cin >> n >> m >> v;
  for (LL i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (LL j = 1; j <= n; j++) {
    cin >> b[j];
  }
  init(maxn);
  for (LL i = 0; i < m; i++) {
    LL x, y;
    cin >> x >> y;
    Union(x, y);
  }
  for (LL i = 1; i <= n; i++) {
    if (find(i) == i) {
      vector<LL> tp;
      LL sumw = 0, sumb = 0;
      for (LL j = 1; j <= n; j++) {
        if (find(j) == i) {
          tp.emplace_back(j);
          sumw += w[j], sumb += b[j];
        }
      }
      for (LL j = 0; j <= v; j++) {
        pd[j] = dp[j];
      }
      for (auto p : tp) {
        for (LL j = w[p]; j <= v; j++) {
          umax(dp[j], pd[j - w[p]] + b[p]);
        }
      }
      for (LL j = sumw; j <= v; j++) {
        umax(dp[j], pd[j - sumw] + sumb);
      }
    }
  }
  cout << dp[v] << '\12';
  return 0;
}
