#include <bits/stdc++.h>
using namespace std;
long long a[10000], b[10002];
int main() {
  int n, k1, k2;
  scanf("%d%d%d", &n, &k1, &k2);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld", &b[i]);
  }
  for (int j = 0; j < k1; j++) {
    int val, index;
    long long mx_prof = -1e16;
    for (int i = 0; i < n; i++) {
      long long prof = (a[i] - b[i]) * (a[i] - b[i]);
      long long prof1 = (a[i] - b[i] + 1) * (a[i] - b[i] + 1);
      long long prof2 = (a[i] - b[i] - 1) * (a[i] - b[i] - 1);
      prof1 = prof - prof1;
      prof2 = prof - prof2;
      if (prof1 > mx_prof) {
        mx_prof = prof1;
        val = 1;
        index = i;
      }
      if (prof2 > mx_prof) {
        mx_prof = prof2;
        val = -1;
        index = i;
      }
    }
    a[index] += val;
  }
  for (int j = 0; j < k2; j++) {
    int val, index;
    long long mx_prof = -1e16;
    for (int i = 0; i < n; i++) {
      long long prof = (a[i] - b[i]) * (a[i] - b[i]);
      long long prof1 = (a[i] - b[i] + 1) * (a[i] - b[i] + 1);
      long long prof2 = (a[i] - b[i] - 1) * (a[i] - b[i] - 1);
      prof1 = prof - prof1;
      prof2 = prof - prof2;
      if (prof1 > mx_prof) {
        mx_prof = prof1;
        val = -1;
        index = i;
      }
      if (prof2 > mx_prof) {
        mx_prof = prof2;
        val = 1;
        index = i;
      }
    }
    b[index] += val;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans = ans + (a[i] - b[i]) * (a[i] - b[i]);
  }
  cout << ans << endl;
}
