#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const double eps = 1e-9;
const int inf = 1e9;
int a[N], b[N];
multiset<pair<long long, int> > ms;
int main() {
  int n, k1, k2;
  cin >> n >> k1 >> k2;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    ms.insert({1ll * (a[i] - b[i]) * (a[i] - b[i]), i});
  }
  while (k1 || k2) {
    long long x = (*ms.rbegin()).first;
    int i = (*ms.rbegin()).second;
    auto p = ms.rbegin();
    ms.erase(ms.find(*p));
    int tmp = a[i] - b[i];
    if (tmp == 0) {
      if (k1) {
        --k1;
        --a[i];
      }
      if (k2) {
        --k2;
        --b[i];
      }
    } else if (tmp > 0) {
      if (k2) {
        --k2;
        ++b[i];
      } else if (k1) {
        --k1;
        --a[i];
      }
    }
    if (tmp < 0) {
      if (k1) {
        --k1;
        ++a[i];
      } else if (k2) {
        --k2;
        --b[i];
      }
    }
    ms.insert({1ll * (a[i] - b[i]) * (a[i] - b[i]), i});
  }
  long long ans = 0;
  for (auto x : ms) ans += x.first;
  cout << ans;
}
