#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const long long mod = 1e9 + 7;
const long long INF = 1e18 + 1LL;
const int inf = 1e9 + 1e8;
const double PI = acos(-1.0);
const int N = 1e5 + 100;
struct Node {
  int a, b, r;
  void updata() { r = abs(a - b); }
  bool friend operator<(Node x, Node y) { return x.r < y.r; }
} arr[1005];
priority_queue<Node> Q;
int main() {
  int n, k1, k2;
  scanf("%d %d %d", &n, &k1, &k2);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &arr[i].a);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &arr[i].b);
    arr[i].updata();
    Q.push(arr[i]);
  }
  while (k1 + k2) {
    Node now = Q.top();
    Q.pop();
    if (k1 > k2) {
      if (now.a > now.b)
        now.a--;
      else
        now.a++;
      now.updata();
      Q.push(now);
      k1--;
    } else {
      if (now.a > now.b)
        now.b++;
      else
        now.b--;
      now.updata();
      Q.push(now);
      k2--;
    }
  }
  long long ans = 0;
  while (!Q.empty()) {
    Node now = Q.top();
    Q.pop();
    ans += (long long)now.r * (long long)now.r;
  }
  printf("%lld", ans);
  return 0;
}
