#include <bits/stdc++.h>
using namespace std;
template <typename T>
void debug(T x) {
  cout << "#debug " << x << endl;
}
template <typename T>
void debugarray(T v, long long int n) {
  cout << "#debug ";
  for (long long int i = 0; i <= n - 1; i++) cout << v[i] << " ";
  cout << endl;
}
int main() {
  long long int n, m, k, t, sum = 0;
  cin >> n >> m >> k;
  m += k;
  long long int a[n];
  for (long long int i = 0; i <= n - 1; i++) {
    cin >> a[i];
  }
  map<long long int, long long int> ma;
  set<long long int> s;
  for (long long int i = 0; i <= n - 1; i++) {
    cin >> k;
    a[i] = abs(a[i] - k);
    s.insert(a[i]);
    ma[a[i]]++;
  }
  while (s.size()) {
    k = *(--s.end());
    if (m == 0 || k == 0) break;
    s.insert(k - 1);
    ma[k]--;
    if (ma[k] == 0) s.erase(k);
    ma[k - 1]++;
    m--;
  }
  if (m == 0) {
    sum = 0;
    for (auto &x : s) {
      sum += (x * x) * ma[x];
    }
  } else {
    if (m % 2 != 0) sum++;
  }
  cout << sum << endl;
  return 0;
}
