#include <bits/stdc++.h>
using namespace std;
long long int n, k1, k2;
int finddiff(long long int a1[], long long int b1[]) {
  long long int max = abs(a1[0] - b1[0]);
  int index = 0;
  for (int i = 0; i < n; i++) {
    if (abs(a1[i] - b1[i]) > max) {
      max = abs(a1[i] - b1[i]);
      index = i;
    }
  }
  return index;
}
int main() {
  cin >> n >> k1 >> k2;
  long long int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  while (k1 != 0 || k2 != 0) {
    int j = finddiff(a, b);
    if (k1 > k2) {
      if (a[j] > b[j])
        a[j]--;
      else
        a[j]++;
      k1--;
    } else {
      if (b[j] > a[j])
        b[j]--;
      else
        b[j]++;
      k2--;
    }
  }
  long long int error = 0;
  for (int i = 0; i < n; i++) {
    error = error + pow(abs(a[i] - b[i]), 2);
  }
  cout << error << "\n";
  return 0;
}
