#include <bits/stdc++.h>
using namespace std;
vector<int> v[1010];
vector<int> g[1010];
bool vi[1010];
void dfs(int x, int root) {
  v[root].push_back(x);
  vi[x] = true;
  for (auto i : g[x]) {
    if (vi[i] == true) continue;
    dfs(i, root);
  }
}
int N;
int w[1010];
int b[1010];
const long long inf = 1e15;
int des;
long long fn[1005][1005];
long long dp(int x, int weight) {
  if (weight > des) return -inf;
  if (x == N + 1) return 0;
  int sum = 0;
  int gum = 0;
  long long &ans = fn[x][weight];
  if (ans != -1) return ans;
  ans = dp(x + 1, weight);
  for (auto i : v[x]) {
    sum += w[i];
    gum += b[i];
    ans = max(ans, dp(x + 1, weight + w[i]) + b[i]);
  }
  ans = max(ans, dp(x + 1, weight + sum) + gum);
  return ans;
}
int main(int argc, char const *argv[]) {
  int n, m;
  scanf("%d %d %d", &n, &m, &des);
  for (int i = 1; i <= n; i++) {
    scanf("%d", w + i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", b + i);
  }
  for (int i = 0; i < m; i++) {
    int p, q;
    scanf("%d %d", &p, &q);
    g[p].push_back(q);
    g[q].push_back(p);
  }
  for (int i = 1; i <= n; i++) {
    if (vi[i] == false) {
      dfs(i, ++N);
    }
  }
  memset(fn, -1, sizeof fn);
  printf("%lld\n", dp(1, 0));
  return 0;
}
