#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, s, d, i, j, k;
  cin >> a >> s >> d;
  vector<long long> v1, v2;
  map<long long, long long> m;
  map<long long, long long>::reverse_iterator ii;
  map<long long, long long>::iterator jj;
  for (i = 1; i <= a; i++) {
    cin >> k;
    v1.push_back(k);
  }
  for (i = 1; i <= a; i++) {
    cin >> k;
    m[abs(v1[i - 1] - k)]++;
  }
  long long sum = s + d;
  while (1) {
    ii = m.rbegin();
    long long a1, a2;
    a1 = ii->first;
    a2 = ii->second;
    if (a1 == 0) sum = sum % 2;
    if (a2 <= sum) {
      m.erase(a1);
      m[a1 - 1] += a2;
      sum -= a2;
    } else {
      m[a1 - 1] += sum;
      m[a1] -= sum;
      sum = 0;
      break;
    }
  }
  long long otv = 0;
  for (jj = m.begin(); jj != m.end(); jj++) {
    long long a1, a2;
    a1 = jj->first;
    a2 = jj->second;
    for (i = 0; i < a2; i++) {
      otv += a1 * a1;
    }
  }
  cout << otv;
}
