#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k1, k2;
  cin >> n >> k1 >> k2;
  pair<long long, long long> a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
  }
  for (long long i = 0; i < n; i++) {
    cin >> a[i].second;
  }
  priority_queue<pair<long long, pair<long long, long long> > > q;
  for (long long i = 0; i < n; i++) {
    pair<long long, pair<long long, long long> > t;
    t.first = abs(a[i].first - a[i].second);
    t.second.first = a[i].first;
    t.second.second = a[i].second;
    q.push(t);
  }
  while (k1 > 0 || k2 > 0) {
    pair<long long, pair<long long, long long> > temp = q.top();
    q.pop();
    long long diff = temp.first;
    pair<long long, long long> k = temp.second;
    long long mean = (k.first + k.second) / 2;
    if (k1 > 0 && k2 > 0) {
      if (!q.empty()) {
        pair<long long, pair<long long, long long> > temp1 = q.top();
        pair<long long, long long> p = temp1.second;
        long long mean2 = (p.first + p.second) / 2;
        if (abs(k1 - (abs(p.first - mean2))) >
            abs(k2 - abs(p.second - mean2))) {
          k1--;
          if (k.first < k.second)
            k.first++;
          else
            k.first--;
        } else {
          k2--;
          if (k.first < k.second)
            k.second--;
          else
            k.second++;
        }
      } else if (abs(k1 - (abs(k.first - mean))) >
                 abs(k2 - abs(k.second - mean))) {
        k1--;
        if (k.first < k.second)
          k.first++;
        else
          k.first--;
      } else {
        k2--;
        if (k.first < k.second)
          k.second--;
        else
          k.second++;
      }
    } else if (k1 > 0) {
      if (k.first < k.second) {
        k.first++;
        k1--;
      } else {
        k.first--;
        k1--;
      }
    } else {
      if (k.first < k.second) {
        k.second--;
        k2--;
      } else {
        k.second++;
        k2--;
      }
    }
    diff = abs(k.first - k.second);
    temp.first = diff;
    temp.second = k;
    q.push(temp);
  }
  long long ans = 0;
  while (!q.empty()) {
    pair<long long, pair<long long, long long> > temp = q.top();
    q.pop();
    long long diff = temp.first;
    ans += (diff * diff);
  }
  cout << ans << endl;
  return 0;
}
