#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1e3 + 10;
long long a[SIZE];
priority_queue<long long> que;
int main() {
  int n, k1, k2;
  scanf("%d%d%d", &n, &k1, &k2);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[1008]);
    que.push(abs(a[1008] - a[i]));
  }
  k1 += k2;
  while (k1) {
    long long x = que.top();
    que.pop();
    k1--;
    x--;
    que.push(abs(x));
  }
  long long ans = 0;
  while (que.size()) {
    long long sum = que.top();
    ans += 1LL * sum * sum;
    que.pop();
  }
  printf("%lld\n", ans);
  return 0;
}
