#include <bits/stdc++.h>
using namespace std;
int a[10005], b[10005];
int main() {
  int n, k1, k2;
  cin >> n >> k1 >> k2;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= k1 + k2; i++) {
    int mx = -1;
    int ind = 1;
    for (int j = 1; j <= n; j++) {
      if (abs(a[j] - b[j]) > mx) {
        mx = abs(a[j] - b[j]);
        ind = j;
      }
    }
    if (a[ind] > b[ind])
      a[ind]--;
    else
      a[ind]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long w = abs(a[i] - b[i]);
    ans += w * w;
  }
  cout << ans << '\n';
}
