#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int k1;
  int k2;
  cin >> n >> k1 >> k2;
  int k = k1 + k2;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
  }
  vector<int> b;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    b.push_back(t);
  }
  vector<long long> c;
  for (int i = 0; i < n; i++) {
    c.push_back(abs(a[i] - b[i]));
  }
  for (int kk = 0; kk < k; kk++) {
    int ii = 0;
    for (int i = 0; i < n; i++) {
      if (c[i] > c[ii]) ii = i;
    }
    if (c[ii] == 0) {
      int left = kk - (k);
      if (left % 2 == 0) {
        cout << 0 << "\n";
      } else {
        cout << 1 << "\n";
      }
      return 0;
    }
    c[ii]--;
  }
  long long ans = 0;
  for (long long x : c) ans += x * x;
  cout << ans << "\n";
}
