#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 20;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
long long in[1050];
int main() {
  int N, k1, k2, i, j, k;
  scanf("%d %d %d", &N, &k1, &k2);
  int K = k1 + k2;
  for (i = 1; i <= N; i++) {
    long long t;
    scanf("%lld", &t);
    in[i] += t;
  }
  for (i = 1; i <= N; i++) {
    long long t;
    scanf("%lld", &t);
    in[i] -= t;
  }
  while (K--) {
    int mxp = 1;
    for (i = 2; i <= N; i++)
      if (abs(in[mxp]) < abs(in[i])) mxp = i;
    if (in[mxp] >= 0)
      in[mxp]--;
    else
      in[mxp]++;
  }
  long long ans = 0;
  for (i = 1; i <= N; i++) ans += in[i] * in[i];
  return !printf("%lld\n", ans);
}
