#include <bits/stdc++.h>
using namespace std;
const long long MN = (long long)1000 * 1000 + 5,
                INF = (long long)1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 5;
long long n, m, Q;
long long res = 0;
string s;
long long t[MN], p[MN];
priority_queue<long long> q;
int32_t main() {
  long long i, j, a, b, x, y;
  char c;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(7) << fixed;
  cin >> n >> x >> y;
  m = x + y;
  for (long long i = 0; i < n; i++) {
    cin >> t[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (long long i = 0; i < n; i++) {
    t[i] = abs(t[i] - p[i]);
    res += t[i] * t[i];
    q.push(t[i]);
    ;
    ;
  }
  for (long long i = 0; i < m; i++) {
    a = q.top();
    q.pop();
    res -= 2 * (a - 1) + 1;
    q.push(abs(a - 1));
  }
  cout << res << endl;
  return 0;
}
