#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, K1, K2;
  cin >> N >> K1 >> K2;
  long long int a[N + 1], b[N + 1], diff[N + 1];
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= N; i++) {
    cin >> b[i];
    diff[i] = abs(a[i] - b[i]);
  }
  sort(diff + 1, diff + 1 + N);
  diff[0] = 0;
  long long int total_moves = K1 + K2;
  for (int i = N; i >= 0 && total_moves; i--) {
    while (total_moves && i + 1 <= N && diff[i + 1] > diff[i]) {
      for (int j = i + 1; j <= N && total_moves; j++) {
        long long int to_subtract = 1;
        diff[j] -= to_subtract;
        total_moves -= to_subtract;
      }
    }
  }
  long long int ans = 0;
  total_moves %= 2;
  int idx = 1;
  while (total_moves > 0) {
    diff[idx]++;
    idx++;
    if (idx > N) idx = 1;
    total_moves--;
  }
  for (int i = 1; i <= N; i++) {
    ans += (diff[i] * diff[i]);
  }
  cout << ans << endl;
  return 0;
}
