#include <bits/stdc++.h>
const long long sze = 1e3 + 10, psze = 30, INF = 1e18;
using namespace std;
long long bin_pow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1 == 1) {
      res *= a;
    }
    a *= a;
    b /= 2;
  }
  return res;
}
long long bin_pow(long long a, long long b, long long p) {
  long long res = 1;
  while (b) {
    if (b & 1 == 1) {
      res *= a % p;
    }
    a *= a % p;
    b /= 2;
  }
  return res;
}
vector<long long> vertices[sze];
vector<char> visit(sze);
vector<long long> dp(sze, 0);
long long arr[sze];
long long a[sze];
long long b[sze];
long long blnc[sze];
long long tdp[200][200];
bool did_dp[101][101];
bool checker[sze];
long long n;
long long m;
long long k;
long long cnt = 0;
double logr(long long n, long long k) { return double(log(n) / log(k)); }
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k >> m;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    blnc[i] = abs(b[i] - a[i]);
  }
  k = k + m;
  sort(blnc, blnc + n);
  for (long long i = n - 1; i > 0; i--) {
    long long d = blnc[i] - blnc[i - 1];
    m = n - i;
    if (m * d > k) {
      long long a = k / m;
      long long b = k % m;
      k = 0;
      for (long long j = n - 1; j >= i; j--) {
        blnc[j] -= a;
        if (b > 0) {
          blnc[j]--;
          b--;
        }
      }
    } else {
      k -= m * d;
      for (long long j = n - 1; j >= i; j--) {
        blnc[j] = blnc[i - 1];
      }
    }
    if (k == 0) break;
  }
  if (k > 0 && blnc[0] != 0) {
    long long d = blnc[0];
    if (d * n > k) {
      long long a = k / n;
      long long b = k % n;
      k = 0;
      for (long long j = n - 1; j >= 0; j--) {
        blnc[j] -= a;
        if (b > 0) {
          blnc[j]--;
          b--;
        }
      }
    } else {
      k -= n * d;
      for (long long j = n - 1; j >= 0; j--) {
        blnc[j] = 0;
      }
    }
  }
  if (k > 0 && blnc[0] == 0) {
    long long b = k % 2;
    if (b) blnc[0]++;
  }
  for (long long i = 0; i < n; i++) {
    cnt += blnc[i] * blnc[i];
  }
  cout << cnt;
  return 0;
}
