#include <bits/stdc++.h>
using namespace std;
const int m = 1e3 + 10;
long long int a[m], b[m], arr[m];
int main() {
  int N;
  cin >> N;
  int k1, k2;
  cin >> k1 >> k2;
  int chance = k1 + k2;
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) cin >> b[i];
  for (int i = 0; i < N; i++) arr[i] = abs(a[i] - b[i]);
  long long int ans = 0, init, index;
  while (chance--) {
    init = 0, index = 0;
    for (int i = 0; i < N; i++)
      if (arr[i] >= init) {
        init = arr[i];
        index = i;
      }
    arr[index] = abs(arr[index] - 1);
  }
  for (int i = 0; i < N; i++) ans += arr[i] * arr[i];
  cout << ans << endl;
  return 0;
}
