#include <bits/stdc++.h>
using namespace std;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int& n, int b) { n |= two(b); }
inline void unset_bit(int& n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) {
  int res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
bool comparator(int i, int j) { return (i < j); }
long long gcd(long long x, long long y) {
  long long t;
  while (y != 0) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}
bool isVowel(char ch) {
  if (ch == 'a' || ch == 'i' || ch == 'e' || ch == 'u' || ch == '0' ||
      ch == 'y') {
    return true;
  }
  return false;
}
bool isPrime(int n) {
  int root = sqrt(n);
  for (int i = 2; i <= root; i++)
    if (n % i == 0) return 0;
  return 1;
}
long long n, k1, k2, zr;
long long a[1001], b[1001];
priority_queue<long long> pq;
int main() {
  cin >> n >> k1 >> k2;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int val = 0; val < k1; val++) {
    long long mx = -1;
    long long idx = -1;
    for (int i = 0; i < n; i++) {
      if (abs(a[i] - b[i]) < mx) continue;
      mx = abs(a[i] - b[i]);
      idx = i;
    }
    if (a[idx] > b[idx])
      a[idx]--;
    else
      a[idx]++;
  }
  for (int val = 0; val < k2; val++) {
    long long mx = -1;
    long long idx = -1;
    for (int i = 0; i < n; i++) {
      if (abs(a[i] - b[i]) < mx) continue;
      mx = abs(a[i] - b[i]);
      idx = i;
    }
    if (a[idx] > b[idx])
      b[idx]++;
    else
      b[idx]--;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (a[i] - b[i]) * (a[i] - b[i]);
  }
  cout << ans << endl;
}
