#include <bits/stdc++.h>
using namespace std;
struct cmpr {
  bool operator()(pair<int, int> const& lhs, pair<int, int> const& rhs) const {
    if (lhs.first > rhs.first)
      return true;
    else if (lhs.first == rhs.first) {
      return lhs.second > rhs.second;
    }
    return false;
  }
};
int main() {
  int n, a_c, b_c;
  std::vector<int> a(n);
  std::vector<int> b(n);
  cin >> n >> a_c >> b_c;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  set<pair<int, int>, cmpr> heap_set;
  set<pair<int, int> >::iterator it;
  for (int i = 0; i < n; i++) {
    heap_set.insert(pair<int, int>(abs(a[i] - b[i]), i));
  }
  int t1, t2;
  int f1, f2;
  for (int i = 0; i < a_c; i++) {
    it = heap_set.begin();
    t1 = it->first;
    t2 = it->second;
    heap_set.erase(it);
    if (t1 == 0)
      t1++;
    else
      t1--;
    heap_set.insert(pair<int, int>(t1, t2));
  }
  for (int i = 0; i < b_c; i++) {
    it = heap_set.begin();
    t1 = it->first;
    t2 = it->second;
    heap_set.erase(it);
    if (t1 == 0)
      t1++;
    else
      t1--;
    heap_set.insert(pair<int, int>(t1, t2));
  }
  long long int sum = 0;
  for (it = heap_set.begin(); it != heap_set.end(); it++) {
    sum += ((long long)it->first) * ((long long)it->first);
  }
  cout << sum << endl;
  return 0;
}
