#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, k1, k2;
  cin >> n >> k1 >> k2;
  long long a[n];
  long long b[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
  }
  priority_queue<pair<long long, long long> > pq;
  for (long long i = 0; i < n; i++) {
    if (abs(a[i] - b[i]) > 0) pq.push(make_pair(abs(a[i] - b[i]), i));
  }
  while (!pq.empty() && (k1 + k2) > 0) {
    pair<long long, long long> p = pq.top();
    pq.pop();
    long long idx = p.second;
    if (k1 > k2) {
      if (a[idx] > b[idx])
        a[idx]--;
      else
        a[idx]++;
      k1--;
    } else {
      if (b[idx] > a[idx])
        b[idx]--;
      else
        b[idx]++;
      k2--;
    }
    if (abs(a[idx] - b[idx]) > 0) pq.push(make_pair(abs(a[idx] - b[idx]), idx));
  }
  long long res = 0;
  if (k1 + k2 > 0) {
    long long temp = min(k1, k2);
    k1 -= temp;
    k2 -= temp;
    long long x = max(k1, k2);
    res += x % 2;
  }
  for (long long i = 0; i < n; i++) {
    res += (abs(a[i] - b[i])) * (abs(a[i] - b[i]));
  }
  cout << res;
  return 0;
}
