#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n, m, W;
int w[1010];
int b[1010];
vector<int> g[1010];
int sz = 0;
int used[1010];
int cost[1010], weight[1010];
vector<pair<int, int> > girls[1010];
int dp[1010][1010];
void dfs(int v) {
  cost[sz] += b[v];
  weight[sz] += w[v];
  girls[sz].push_back(make_pair(w[v], b[v]));
  used[v] = sz;
  for (__typeof(g[v].begin()) it = g[v].begin(); it != g[v].end(); it++) {
    int to = *it;
    if (used[to] == -1) dfs(to);
  }
}
int calc(int ind, int massa) {
  if (massa < 0) return -inf;
  if (ind == sz) return 0;
  int &res = dp[ind][massa];
  if (res != -1) return res;
  res = calc(ind + 1, massa);
  res = max(res, cost[ind] + calc(ind + 1, massa - weight[ind]));
  for (__typeof(girls[ind].begin()) it = girls[ind].begin();
       it != girls[ind].end(); it++) {
    int W = (*it).first;
    int C = (*it).second;
    res = max(res, C + calc(ind + 1, massa - W));
  }
  return res;
}
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, x, y; i < m; i++) {
    scanf("%d%d", &x, &y);
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  memset(used, -1, sizeof used);
  for (int i = 0; i < n; i++) {
    if (used[i] == -1) {
      dfs(i);
      sz++;
    }
  }
  memset(dp, -1, sizeof dp);
  cout << calc(0, W) << endl;
  return 0;
}
