#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (a && b) {
    if (a >= b)
      a %= b;
    else
      b %= a;
  }
  return a + b;
}
long long power(long long a, long long n) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long power(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
int getint() {
  char c;
  int ret = c - '0', sgn = 0;
  while ((c = getchar()) && !(c >= '0' && c <= '9') && c != '-')
    ;
  if (c == '-') sgn = 1, ret = 0;
  while ((c = getchar()) && c >= '0' && c <= '9') ret = ret * 10 + c - '0';
  if (sgn) ret = -ret;
  return ret;
}
const int maxn = 1e3 + 10;
const int maxm = maxn * 2;
const int inf = 1e9 + 10;
const long long mod = 1e9 + 7;
vector<int> g[maxn];
vector<pair<int, int> > zu[maxn];
int a[maxn], b[maxn], vis[maxn];
int cnt;
void dfs(int u) {
  vis[u] = 1;
  zu[cnt].push_back(make_pair(a[u], b[u]));
  int sz = g[u].size();
  for (int i = 0; i < sz; i++) {
    int v = g[u][i];
    if (vis[v]) continue;
    dfs(v);
  }
}
int c[maxn][2], dp[3][maxn][maxn];
int main() {
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), g[i].clear(), zu[i].clear();
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  memset(vis, 0, sizeof(vis));
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    ++cnt;
    dfs(i);
  }
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= cnt; i++) {
    int x = 0, y = 0;
    int sz = zu[i].size();
    for (int j = 0; j < sz; j++) {
      x += zu[i][j].first;
      y += zu[i][j].second;
    }
    for (int j = 0; j <= w; j++) {
      if (j >= x) {
        dp[0][i][j] = max(dp[0][i][j], dp[0][i - 1][j - x] + y);
        dp[0][i][j] = max(dp[0][i][j], dp[1][i - 1][j - x] + y);
        dp[0][i][j] = max(dp[0][i][j], dp[2][i - 1][j - x] + y);
      }
    }
    for (int j = 0; j <= w; j++) {
      for (int k = 0; k < sz; k++) {
        int xx = zu[i][k].first;
        int yy = zu[i][k].second;
        if (j >= xx)
          dp[1][i][j] = max(dp[1][i][j], max(dp[0][i - 1][j - xx] + yy,
                                             dp[1][i - 1][j - xx] + yy));
        if (j >= xx) dp[1][i][j] = max(dp[1][i][j], dp[2][i - 1][j - xx] + yy);
      }
      int temp = max(dp[0][i - 1][j], max(dp[1][i - 1][j], dp[2][i - 1][j]));
      dp[2][i][j] = max(dp[2][i][j], temp);
    }
  }
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    ans = max(ans, dp[i][cnt][w]);
  }
  cout << ans << endl;
  return 0;
}
