#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1);
const long long INFF = 1e18;
const int INF = 1e9 + 1;
const int mod = 1e9 + 7;
const int MAX = 1e4 + 7;
int siz[MAX], gp[MAX];
vector<int> mem[MAX];
int fd(int v) { return gp[v] == v ? v : gp[v] = fd(gp[v]); }
void uni(int u, int v) {
  u = fd(u);
  v = fd(v);
  if (u == v) return;
  if (siz[u] > siz[v]) swap(u, v);
  for (int x : mem[u]) mem[v].push_back(x);
  siz[v] += siz[u];
  gp[u] = v;
  return;
}
int w[MAX];
long long b[MAX];
vector<int> al;
long long dp[MAX];
long long dp2[MAX];
int main(void) {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  ;
  for (int i = (1); i < (n + 1); ++i) {
    siz[i] = 1;
    gp[i] = i;
    mem[i].push_back(i);
  }
  for (int i = (1); i < (n + 1); ++i) scanf("%d", w + i);
  for (int i = (1); i < (n + 1); ++i) scanf("%lld", b + i);
  for (int i = (1); i < (m + 1); ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    ;
    uni(u, v);
  }
  for (int i = (1); i < (n + 1); ++i) al.push_back(fd(i));
  sort((al).begin(), (al).end());
  al.resize(unique((al).begin(), (al).end()) - al.begin());
  for (int v : al) {
    memset(dp2, 0, sizeof(dp2));
    ;
    int cv = 0;
    long long cb = 0;
    for (int u : mem[v]) {
      cv += w[u];
      cb += b[u];
      for (int i = (w[u]); i < (k + 1); ++i) {
        if (i != w[u] && !dp[i - w[u]]) continue;
        dp2[i] = max(dp2[i], dp[i - w[u]] + b[u]);
      }
    }
    for (int i = (cv); i < (k + 1); ++i) {
      if (i != cv && !dp[i - cv]) continue;
      dp2[i] = max(dp2[i], dp[i - cv] + cb);
    }
    for (int i = 0; i < (k + 1); ++i) dp[i] = max(dp[i], dp2[i]);
  }
  long long ans = 0;
  for (int i = 0; i < (k + 1); ++i) ans = max(ans, dp[i]);
  printf("%lld\n", ans);
  return 0;
}
