#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "{";
  for (const T &a : v) out << a << ", ";
  out << "}";
  return out;
}
template <typename S, typename T>
ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}
const int dx[] = {0, 0, -1, 1};
const int dy[] = {-1, 1, 0, 0};
int n, m, w;
vector<int> out[1010];
int B[1010], W[1010];
bool vis[1010];
vector<int> group;
void dfs(int u) {
  vis[u] = 1;
  group.push_back(u);
  for (int v : out[u])
    if (!vis[v]) dfs(v);
}
int dp[2][1010];
int main() {
  scanf("%d %d %d", &n, &m, &w);
  for (int i = (0); i < (n); ++i) scanf("%d", &W[i]);
  for (int i = (0); i < (n); ++i) scanf("%d", &B[i]);
  for (int i = (0); i < (m); ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a;
    --b;
    out[a].push_back(b);
    out[b].push_back(a);
  }
  int a = 0, b = 1;
  for (int i = (0); i < (n); ++i)
    if (!vis[i]) {
      group.clear();
      dfs(i);
      for (int i = (0); i < (w + 1); ++i) dp[b][i] = dp[a][i];
      int tw = 0, tb = 0;
      for (int u : group) {
        tw += W[u];
        tb += B[u];
        for (int i = (0); i < (w + 1); ++i)
          if (i >= W[u]) dp[b][i] = max(dp[b][i], dp[a][i - W[u]] + B[u]);
      }
      for (int i = (0); i < (w + 1); ++i)
        if (i >= tw) dp[b][i] = max(dp[b][i], dp[a][i - tw] + tb);
      swap(a, b);
    }
  printf("%d\n", dp[a][w]);
  return 0;
}
