#include <bits/stdc++.h>
using namespace std;
const long long MaxN = 1e3 + 10;
long long a[MaxN], b[MaxN];
int main() {
  long long n, k1, k2;
  cin >> n >> k1 >> k2;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; ++i) {
    cin >> b[i];
  }
  vector<long long> diffs(n);
  for (long long i = 0; i < n; ++i) {
    diffs[i] = abs(a[i] - b[i]);
  }
  sort(diffs.begin(), diffs.end());
  long long steps = k1 + k2;
  long long ans = 0;
  while (steps > 0) {
    for (long long i = n - 1; i >= 0; --i) {
      if (i == 0) {
        if (diffs[0] == 0) {
          ans = steps % 2;
          steps = 0;
          break;
        }
        steps--;
        diffs[0]--;
        break;
      }
      if (diffs[i - 1] < diffs[i]) {
        diffs[i]--;
        steps--;
        break;
      }
    }
  }
  for (long long i = 0; i < n; ++i) {
    ans += diffs[i] * diffs[i];
  }
  cout << ans;
}
