#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long val, t, n, f, a, m, q, l, r, k, i, j, x1, y1, x, b1, b2, e, x0, y0,
      w, y, z, p, v, b, c, d, u, num, k1, k2;
  cin >> n >> k1 >> k2;
  vector<long long> arr1(n), arr2(n);
  for (i = 0; i < n; i++) cin >> arr1[i];
  for (i = 0; i < n; i++) cin >> arr2[i];
  vector<pair<long long, long long> > diff(n);
  for (i = 0; i < n; i++) diff[i] = {abs(arr1[i] - arr2[i]), i};
  sort(diff.rbegin(), diff.rend());
  while (true) {
    if (k1 == 0 && k2 == 0) break;
    i = diff[0].second;
    if (diff[0].first == 0) {
      if ((k1 + k2) % 2 == 0) {
        cout << 0;
      } else
        cout << 1;
      return 0;
    }
    if (k1) {
      if (arr2[i] > arr1[i])
        arr1[i]++;
      else
        arr1[i]--;
      k1--;
    } else {
      if (arr2[i] > arr1[i])
        arr2[i]--;
      else
        arr2[i]++;
      k2--;
    }
    diff[0].first--;
    sort(diff.rbegin(), diff.rend());
  }
  val = 0;
  for (i = 0; i < n; i++) val += (arr1[i] - arr2[i]) * (arr1[i] - arr2[i]);
  cout << val;
  return 0;
}
