#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 998244353;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 998244353;
    }
    a = (a * a) % 998244353;
    b >>= 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 998244353 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
void solve() {
  long long n, k1, k2;
  cin >> n >> k1 >> k2;
  long long a[n], b[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  priority_queue<long long> q;
  for (long long i = 0; i < n; i++) {
    q.push(abs(a[i] - b[i]));
  }
  long long k = k1 + k2;
  long long ans = 0;
  while (k > 0) {
    long long d = q.top();
    q.pop();
    d--;
    q.push(abs(d));
    k--;
  }
  while (!q.empty()) {
    long long val = q.top();
    q.pop();
    val = abs(val);
    ans += (val * val);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
