#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5;
vector<int> v[100009];
int h[100009], b[100009];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m, k, x = 0, j, z = 0, i, h = 1, maxm = 0, sum = 0, y = 0, p,
                         l, u = 0;
  cin >> n >> k >> l;
  int a[n + 1], b[n + 1], c[n + 1];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < n; i++) c[i] = abs(a[i] - b[i]);
  k = k + l;
  while (k > 0) {
    j = max_element(c, c + n) - c;
    if (c[j] != 0) {
      c[j]--;
      k--;
    } else {
      if (k & 1)
        cout << 1;
      else
        cout << 0;
      return 0;
    }
  }
  for (i = 0; i < n; i++) sum += pow(c[i], 2);
  cout << sum;
}
