#include <bits/stdc++.h>
using namespace std;
const double inf = 1.0 / 0.0;
const double pi = 2 * acos(0.0);
int cmp_double(double a, double b = 0, double eps = 1e-9) {
  return a + eps > b ? b + eps > a ? 0 : 1 : -1;
}
long long vetA[1010];
long long vetB[1010];
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, k1, k2;
  cin >> n >> k1 >> k2;
  priority_queue<long long> err;
  for (int i = 0; i < int(n); i++) cin >> vetA[i];
  for (int i = 0; i < int(n); i++) cin >> vetB[i];
  long long tot = k1 + k2;
  ;
  for (int i = 0; i < int(n); i++) {
    err.push(abs(vetA[i] - vetB[i]));
  }
  while (tot > 0) {
    long long val = err.top();
    err.pop();
    if (val > 0)
      val--;
    else
      val = 1;
    tot--;
    err.push(val);
  }
  long long resp = 0;
  for (int i = 0; i < int(n); i++) {
    long long val = err.top();
    err.pop();
    resp += val * val;
  }
  cout << resp << endl;
  return 0;
}
