#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int M = 1000000007;
int n, k1, k2;
int a[N], b[N];
inline long long sqr(long long x) { return x * x; }
int main() {
  while (~scanf("%d%d%d", &n, &k1, &k2)) {
    priority_queue<pair<long long, int>> que;
    for (int i = 0; i < n; i++) {
      scanf("%d", a + i);
    }
    for (int i = 0; i < n; i++) {
      scanf("%d", b + i);
      que.push({sqr(a[i] - b[i]), i});
    }
    while (k1 || k2) {
      long long mx = que.top().first, pos = que.top().second;
      que.pop();
      if (k1) {
        if (a[pos] <= b[pos]) {
          a[pos]++;
        } else {
          a[pos]--;
        }
        k1--;
      } else {
        if (a[pos] <= b[pos]) {
          b[pos]--;
        } else {
          b[pos]++;
        }
        k2--;
      }
      que.push({sqr(a[pos] - b[pos]), pos});
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      ans += sqr(a[i] - b[i]);
    }
    printf("%I64d\n", ans);
  }
}
