#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, l, m, n, o;
  long long testcase;
  long long input, flag, tag, ans;
  long long k1, k2;
  cin >> n >> k1 >> k2;
  k = k1 + k2;
  long long a[2000];
  long long b[2000];
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (i = 1; i <= n; i++) scanf("%lld", &b[i]);
  while (k > 0) {
    long long mx = -1;
    for (i = 1; i <= n; i++) mx = max(mx, abs(a[i] - b[i]));
    if (mx == 0) break;
    for (i = 1; i <= n; i++) {
      if (mx == abs(a[i] - b[i])) {
        if (a[i] > b[i]) {
          a[i] -= min(k, 1LL);
        } else {
          b[i] -= min(k, 1LL);
        }
        k -= min(k, 1LL);
      }
    }
  }
  if (k < 0) k = 0;
  ans = 0;
  for (i = 1; i <= n; i++) ans += ((a[i] - b[i]) * (a[i] - b[i]));
  if (k % 2 != 0) ans++;
  cout << ans << endl;
}
