#include <bits/stdc++.h>
using namespace std;
long long a[10009], b[10009];
bool mark[1009];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k1, k2;
  cin >> n >> k1 >> k2;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  priority_queue<pair<long long, int> > q;
  for (int i = 0; i < n; i++) {
    if (a[i] >= b[i]) {
      mark[i] = false;
    } else {
      mark[i] = true;
    }
    q.push(make_pair(abs(a[i] - b[i]), i));
  }
  while ((!q.empty()) && (k1 > 0 || k2 > 0)) {
    pair<long long, int> p = q.top();
    q.pop();
    if (mark[p.second]) {
      if (k1 > 0) {
        k1--;
        a[p.second]++;
        if (a[p.second] >= b[p.second]) {
          mark[p.second] = false;
        } else {
          mark[p.second] = true;
        }
        q.push(make_pair(abs(a[p.second] - b[p.second]), p.second));
      } else if (k2 > 0) {
        k2--;
        b[p.second]--;
        if (a[p.second] >= b[p.second]) {
          mark[p.second] = false;
        } else {
          mark[p.second] = true;
        }
        q.push(make_pair(abs(a[p.second] - b[p.second]), p.second));
      }
    } else {
      if (k2 > 0) {
        k2--;
        b[p.second]++;
        if (a[p.second] >= b[p.second]) {
          mark[p.second] = false;
        } else {
          mark[p.second] = true;
        }
        q.push(make_pair(abs(a[p.second] - b[p.second]), p.second));
      } else if (k1 > 0) {
        k1--;
        a[p.second]--;
        if (a[p.second] >= b[p.second]) {
          mark[p.second] = false;
        } else {
          mark[p.second] = true;
        }
        q.push(make_pair(abs(a[p.second] - b[p.second]), p.second));
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans = ans + ((a[i] - b[i]) * (a[i] - b[i]));
  }
  cout << ans << endl;
}
