#include <bits/stdc++.h>
using namespace std;
int n, m, mw, w[1005], b[1005], mx, x, y, id, dp[2][1005], gb[1005], gw[1005];
bool ch[1005];
list<int> mlist[1005], g[1005];
queue<int> mq;
int main() {
  scanf("%d %d %d", &n, &m, &mw);
  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) {
    scanf("%d %d", &x, &y);
    --x;
    --y;
    mlist[x].push_back(y);
    mlist[y].push_back(x);
  }
  for (int i = 0; i < n; ++i) {
    if (!ch[i]) {
      ch[i] = true;
      mq.push(i);
      while (!mq.empty()) {
        x = mq.front();
        mq.pop();
        g[id].push_back(x);
        gb[id] += b[x];
        gw[id] += w[x];
        for (list<int>::iterator it = mlist[x].begin(); it != mlist[x].end();
             ++it) {
          if (!ch[*it]) {
            ch[*it] = true;
            mq.push(*it);
          }
        }
      }
      ++id;
    }
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 0; i < id; ++i) {
    for (int j = 0; j < mw; ++j) dp[(i + 1) % 2][j] = dp[i % 2][j];
    for (int j = 0; j < mw; ++j) {
      if (dp[i % 2][j] == -1) continue;
      if (j + gw[i] <= mw)
        dp[(i + 1) % 2][j + gw[i]] =
            max(dp[(i + 1) % 2][j + gw[i]], dp[i % 2][j] + gb[i]);
      for (list<int>::iterator it = g[i].begin(); it != g[i].end(); ++it)
        if (j + w[*it] <= mw)
          dp[(i + 1) % 2][j + w[*it]] =
              max(dp[(i + 1) % 2][j + w[*it]], dp[i % 2][j] + b[*it]);
    }
  }
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j <= mw; ++j) mx = max(mx, dp[i][j]);
  printf("%d\n", mx);
  return 0;
}
