#include <bits/stdc++.h>
using namespace std;
unsigned int max_ID(long long int a[], long long int b[], unsigned int n) {
  unsigned int max_ID;
  unsigned long long int max;
  max_ID = 0;
  max = pow(a[0] - b[0], 2);
  for (unsigned int i = 1; i < n; i++) {
    if (pow(a[i] - b[i], 2) > max) {
      max_ID = i;
      max = pow(a[i] - b[i], 2);
    }
  }
  return max_ID;
}
int main() {
  unsigned int n, k1, k2, ID;
  unsigned long long int sum = 0;
  cin >> n >> k1 >> k2;
  long long int a[n], b[n];
  for (unsigned int i = 0; i < n; i++) cin >> a[i];
  for (unsigned int i = 0; i < n; i++) cin >> b[i];
  while (k1 > 0 || k2 > 0) {
    ID = max_ID(a, b, n);
    if (pow((a[ID] - 1) - b[ID], 2) < pow(a[ID] - b[ID], 2)) {
      if (k1 > 0) {
        a[ID]--;
        k1--;
        continue;
      }
    }
    if (pow(a[ID] - (b[ID] + 1), 2) < pow(a[ID] - b[ID], 2)) {
      if (k2 > 0) {
        b[ID]++;
        k2--;
        continue;
      }
    }
    if (pow(a[ID] - (b[ID] - 1), 2) < pow(a[ID] - b[ID], 2)) {
      if (k2 > 0) {
        b[ID]--;
        k2--;
        continue;
      }
    }
    if (pow((a[ID] + 1) - b[ID], 2) < pow(a[ID] - b[ID], 2)) {
      if (k1 > 0) {
        a[ID]++;
        k1--;
        continue;
      }
    }
    if (pow(a[ID] - b[ID], 2) == 0) {
      if (k1 > 0) {
        a[ID]++;
        k1--;
      } else if (k2 > 0) {
        b[ID]++;
        k2--;
      }
    }
  }
  for (unsigned int i = 0; i < n; i++) {
    sum += pow(a[i] - b[i], 2);
  }
  cout << sum;
  return 0;
}
