#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k1, k2;
  cin >> n >> k1 >> k2;
  long long int a[n];
  long long int b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int Q = 0; Q < k1; Q++) {
    int index = -1;
    long long int error = -1;
    for (int i = 0; i < n; i++) {
      if ((a[i] - b[i]) * (a[i] - b[i]) > error) {
        error = (a[i] - b[i]) * (a[i] - b[i]);
        index = i;
      }
    }
    if (a[index] < b[index]) {
      a[index]++;
    } else
      a[index]--;
  }
  for (int Q = 0; Q < k2; Q++) {
    int index = -1;
    long long int error = -1;
    for (int i = 0; i < n; i++) {
      if ((a[i] - b[i]) * (a[i] - b[i]) > error) {
        error = (a[i] - b[i]) * (a[i] - b[i]);
        index = i;
      }
    }
    if (a[index] < b[index]) {
      b[index]--;
    } else
      b[index]++;
  }
  long long int error = 0;
  for (int i = 0; i < n; i++) {
    error += (a[i] - b[i]) * (a[i] - b[i]);
  }
  cout << error << endl;
  return 0;
}
