#include <bits/stdc++.h>
using namespace std;
priority_queue<long long> p;
int main(int argc, char** argv) {
  long long n, k1, k2, i, z, count = 0, k = 0, min;
  cin >> n >> k1 >> k2;
  long long a[n], b[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (i = 0; i < n; i++) {
    if (a[i] >= b[i]) {
      p.push(a[i] - b[i]);
      k += a[i] - b[i];
    } else {
      p.push(b[i] - a[i]);
      k += b[i] - a[i];
    }
  }
  if (k >= (k1 + k2)) {
    for (i = 0; i < k1 + k2; i++) {
      z = p.top();
      p.pop();
      z--;
      p.push(z);
    }
    while (!p.empty()) {
      count += pow(p.top(), 2);
      p.pop();
    }
  } else {
    if ((k1 + k2 - k) % 2 == 0)
      count = 0;
    else
      count = 1;
  }
  cout << count;
  return 0;
}
