[cpp]
#include <iostream>
#include <algorithm>
using namespace std;
int a[1005],b[1005];
int main(int argc, char *argv[])
{
int n,d,r,i,j,ans;
while(cin>>n>>d>>r&&(n+d+r))
{
for(i=0;i<n;i++) cin>>a[i];
for(i=0;i<n;i++) cin>>b[i];
sort(a,a+n); sort(b,b+n);
for(ans=i=0;i<n;i++)
{
if(a[i]+b[n-i-1]>d) ans+=(a[i]+b[n-1-i]-d)*r;
}
cout<<ans<<endl;
}
return 0;
}