#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5, inf = 0x3f3f3f3f, mod = 1e9 + 7;
const double eps = 1e-6;
int n;
int a[maxn], b[maxn];
int k1, k2;
long long dif[maxn];
signed main() {
  scanf("%d%d%d", &n, &k1, &k2);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
    dif[i] = a[i] - b[i];
  }
  int k = k1 + k2;
  while (k--) {
    sort(dif + 1, dif + 1 + n);
    if (dif[n] < 0) {
      dif[1]++;
    } else if (dif[1] > 0) {
      dif[n]--;
    } else if (abs(dif[n]) > abs(dif[1])) {
      dif[n]--;
    } else {
      dif[1]++;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += dif[i] * dif[i];
  }
  printf("%lld\n", ans);
  return 0;
}
