#include <bits/stdc++.h>
using namespace std;
#define int long long
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define el "\n"
#define Arwa ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fix(x) cout << fixed << setprecision(x)
#define all(v) v.begin(), v.end()
void file()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
bool prime(int n) {
if (n == 2) return true;
if (n % 2 == 0 || n == 1) return false;
for (int i = 3; i * i <= n; i += 2)
if (n % i == 0) return false;
return true;
}
int32_t main()
{
Arwa
int t=1;
//cin>>t;
while(t--)
{
int n,k1,k2;
cin>>n>>k1>>k2;
int a[n],b[n];
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
cin>>b[i];
for(int i=0;i<n;i++)
a[i]=abs(a[i]-b[i]);
sort(a,a+n);
int ops=k1+k2,sum=0;
for(int i=n-1;i>=0&&ops>0;i--)
{
if(ops-a[i]>=0)
{
ops-=a[i];
a[i]=0;
}
else
{
a[i]-=ops;
ops=0;
}
}
for(int i=0;i<n;i++)
sum+=a[i]*a[i];
if(sum==0)
cout<<min(ops,abs(k1-k2))<<el;
else cout<<sum<<el;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIGludCBsb25nIGxvbmcKI2RlZmluZSB5ZXMgY291dCA8PCAiWUVTXG4iCiNkZWZpbmUgbm8gY291dCA8PCAiTk9cbiIKI2RlZmluZSBlbCAiXG4iCiNkZWZpbmUgQXJ3YSBpb3M6OnN5bmNfd2l0aF9zdGRpbygwKTsgY2luLnRpZSgwKTsgY291dC50aWUoMCk7CiNkZWZpbmUgZml4KHgpIGNvdXQgPDwgZml4ZWQgPDwgc2V0cHJlY2lzaW9uKHgpCiNkZWZpbmUgYWxsKHYpIHYuYmVnaW4oKSwgdi5lbmQoKQoKdm9pZCBmaWxlKCkKewogICAgI2lmbmRlZiBPTkxJTkVfSlVER0UKICAgICAgICBmcmVvcGVuKCJpbnB1dC50eHQiLCAiciIsIHN0ZGluKTsKICAgICAgICBmcmVvcGVuKCJvdXRwdXQudHh0IiwgInciLCBzdGRvdXQpOwogICAgI2VuZGlmCn0KCmludCBnY2QoaW50IGEsIGludCBiKSB7IHJldHVybiBiID09IDAgPyBhIDogZ2NkKGIsIGEgJSBiKTsgfQppbnQgbGNtKGludCBhLCBpbnQgYikgeyByZXR1cm4gYSAvIGdjZChhLCBiKSAqIGI7IH0KYm9vbCBwcmltZShpbnQgbikgewogICAgaWYgKG4gPT0gMikgcmV0dXJuIHRydWU7CiAgICBpZiAobiAlIDIgPT0gMCB8fCBuID09IDEpIHJldHVybiBmYWxzZTsKICAgIGZvciAoaW50IGkgPSAzOyBpICogaSA8PSBuOyBpICs9IDIpCiAgICAgICAgaWYgKG4gJSBpID09IDApIHJldHVybiBmYWxzZTsKICAgIHJldHVybiB0cnVlOwp9CgppbnQzMl90IG1haW4oKQp7CiAgICBBcndhCiAgICBpbnQgdD0xOwogICAgLy9jaW4+PnQ7CiAgICB3aGlsZSh0LS0pCiAgICB7CiAgICAgICAgaW50IG4sazEsazI7CiAgICAgICAgY2luPj5uPj5rMT4+azI7CiAgICAgICAgaW50IGFbbl0sYltuXTsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgIGNpbj4+YVtpXTsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgIGNpbj4+YltpXTsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgIGFbaV09YWJzKGFbaV0tYltpXSk7CiAgICAgICAgc29ydChhLGErbik7CiAgICAgICAgaW50IG9wcz1rMStrMixzdW09MDsKICAgICAgICBmb3IoaW50IGk9bi0xO2k+PTAmJm9wcz4wO2ktLSkKICAgICAgICB7CiAgICAgICAgICAgIGlmKG9wcy1hW2ldPj0wKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBvcHMtPWFbaV07CiAgICAgICAgICAgICAgICBhW2ldPTA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBhW2ldLT1vcHM7CiAgICAgICAgICAgICAgICBvcHM9MDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgIHN1bSs9YVtpXSphW2ldOwogICAgICAgIGlmKHN1bT09MCkKICAgICAgICBjb3V0PDxtaW4ob3BzLGFicyhrMS1rMikpPDxlbDsKICAgICAgICBlbHNlIGNvdXQ8PHN1bTw8ZWw7CiAgICB9CiAgICByZXR1cm4gMDsKfQo=