#include <bits/stdc++.h>
using namespace std;
long long int A[1005], B[1005];
long long int V[1005];
int main() {
  int n, k1, k2;
  scanf("%d%d%d", &(n), &(k1), &(k2));
  for (int i = 1; i <= n; i++) scanf("%lld", &(A[i]));
  for (int i = 1; i <= n; i++) scanf("%lld", &(B[i]));
  for (int i = 1; i <= n; i++) {
    long long int a = A[i];
    long long int b = B[i];
    V[i] = abs(a - b);
  }
  int k = k1 + k2;
  while (k1 > 0 || k2 > 0) {
    long long int mx = -100000000000014;
    int index;
    for (int i = 1; i <= n; i++) {
      long long int x = V[i];
      if (x >= mx) {
        mx = x;
        index = i;
      }
    }
    if (A[index] >= B[index]) {
      if (k1 > 0) {
        A[index] -= 1;
        k1 -= 1;
      } else {
        B[index] += 1;
        k2 -= 1;
      }
    } else if (A[index] < B[index]) {
      if (k2 > 0) {
        B[index] -= 1;
        k2 -= 1;
      } else {
        A[index] += 1;
        k1 -= 1;
      }
    }
    V[index] = abs(A[index] - B[index]);
  }
  long long int sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += (V[i] * V[i]);
  }
  printf("%lld\n", sum);
}
