#include <bits/stdc++.h>
using namespace std;
long long n, k1, k2;
long long a[1005];
long long b[1005];
void ReadData() {
  cin >> n >> k1 >> k2;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) cin >> b[i];
}
long long c[1005];
void process() {
  long long k = k1 + k2;
  priority_queue<long long> heap;
  for (long long i = 1; i <= n; i++) {
    c[i] = abs(a[i] - b[i]);
    heap.push(c[i]);
  }
  while (k--) {
    long long tmp = heap.top();
    heap.pop();
    tmp--;
    heap.push(abs(tmp));
  }
  long long res = 0;
  while (!heap.empty()) {
    long long tmp = heap.top();
    heap.pop();
    res += tmp * tmp;
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ReadData();
  process();
}
