#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k1, k2;
  cin >> n >> k1 >> k2;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  multiset<int> s;
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    int x = abs(a[i] - b[i]);
    sum += x;
    s.insert(x);
  }
  if (sum >= k1 + k2) {
    int k = k1 + k2;
    while (k--) {
      auto it = s.end();
      --it;
      int x = *it - 1;
      s.erase(it);
      s.insert(x);
    }
  } else {
    for (int k = 0; k < sum; ++k) {
      auto it = s.end();
      --it;
      int x = *it - 1;
      s.erase(it);
      s.insert(x);
    }
    int k = k1 + k2 - sum, rem = 1000000000, nk1, nk2;
    for (int a = 0; a <= k; ++a) {
      int b = k - a;
      if (a <= k1 && b <= k2) {
        int c = a & 1, d = b & 1;
        if (c && d) --c, --d;
        int t = c + d;
        if (t < rem) rem = t, nk1 = a, nk2 = b;
      }
    }
    k = rem;
    while (k--) {
      auto it = s.begin();
      int x = *it + 1;
      s.erase(it);
      s.insert(x);
    }
  }
  long long ans = 0;
  for (int t : s) ans += (long long)t * t;
  cout << ans << endl;
  return 0;
}
