#include <bits/stdc++.h>
using namespace std;
template <class T>
void smin(T& a, T val) {
  if (a > val) a = val;
}
template <class T>
void smax(T& a, T val) {
  if (a < val) a = val;
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  bool first = true;
  os << "[";
  for (auto i : v) {
    if (!first) os << ", ";
    os << i;
    first = false;
  }
  return os << "]";
}
const int MAX = 100010;
int n, k1, k2;
long long m, k, l, p, a[1005], b[1005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  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; i++) {
    long long m1 = -1;
    for (int j = 1; j <= n; j++)
      if ((a[j] - b[j]) * (a[j] - b[j]) > m1) {
        m1 = (a[j] - b[j]) * (a[j] - b[j]);
        p = j;
      }
    if (a[p] > b[p])
      a[p]--;
    else
      a[p]++;
  }
  for (int i = 1; i <= k2; i++) {
    long long m1 = -1;
    for (int j = 1; j <= n; j++)
      if ((a[j] - b[j]) * (a[j] - b[j]) > m1) {
        m1 = (a[j] - b[j]) * (a[j] - b[j]);
        p = j;
      }
    if (b[p] > a[p])
      b[p]--;
    else
      b[p]++;
  }
  long long res = 0;
  for (int j = 1; j <= n; j++) res += (a[j] - b[j]) * (a[j] - b[j]);
  cout << res;
}
