#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;
const double eps = 1e-6;
using namespace std;
bool eq(const double &a, const double &b) { return fabs(a - b) < eps; }
bool ls(const double &a, const double &b) { return a + eps < b; }
bool le(const double &a, const double &b) { return eq(a, b) || ls(a, b); }
long long gcd(long long a, long long b) { return a == 0 ? b : gcd(b % a, a); };
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long kpow(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m, v;
int f[maxn];
long long dp[maxn];
struct Node {
  int weight, val, id;
} node[maxn];
vector<int> W[maxn], V[maxn];
void init() {
  for (int i = 1; i < (n + 1); ++i) f[i] = i;
}
int fd(int x) {
  if (x == f[x])
    return x;
  else
    return f[x] = fd(f[x]);
}
bool cmp(Node a, Node b) { return fd(a.id) < fd(b.id); }
int main() {
  n = read();
  m = read();
  v = read();
  init();
  for (int i = 1; i < (n + 1); ++i) node[i].weight = read(), node[i].id = i;
  for (int i = 1; i < (n + 1); ++i) node[i].val = read();
  for (int i = 0; i < (m); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    int fu = fd(u), fv = fd(v);
    f[fv] = fu;
  }
  int k = 1;
  sort(node + 1, node + n + 1, cmp);
  W[1].push_back(node[1].weight);
  V[1].push_back(node[1].val);
  long long sumww = node[1].weight, sumvv = node[1].val;
  for (int i = 2; i < (n + 1); ++i) {
    if (fd(node[i].id) != fd(node[i - 1].id)) {
      W[k].push_back(sumww);
      V[k].push_back(sumvv);
      sumww = sumvv = 0;
      k++;
    }
    sumww += node[i].weight;
    sumvv += node[i].val;
    W[k].push_back(node[i].weight);
    V[k].push_back(node[i].val);
  }
  W[k].push_back(sumww);
  V[k].push_back(sumvv);
  for (int i = 1; i < (k + 1); ++i) {
    for (int j = v; j >= (0); --j) {
      for (int t = 0; t < (W[i].size()); ++t) {
        int ww = W[i][t];
        int vv = V[i][t];
        if (j >= ww) dp[j] = max(dp[j], dp[j - ww] + vv);
      }
    }
  }
  printf("%lld\n", dp[v]);
  return 0;
}
