#include<iostream>#include<cmath>#include<cstdio>#include<cstring>#include<algorithm>#define ll long long
using namespace std;
const ll maxn=200005,maxn1=1000000007;
int n,i,j,k;
ll l[maxn],t[maxn],ans,a,b,c[maxn],g[maxn];
ll mi(ll x,inty){
if (!y) return1;
if (y==1) returnx;
ll t=mi(x,y/2); if (y%2) return t*t%maxn1*x%maxn1;return t*t%maxn1; } int main(){ // freopen("data.in","r",stdin);
scanf("%d%lld%lld",&n,&a,&b);
for (i=1;i<=n;i++)
scanf("%lld",&l[i]);
for (i=1;i<=n;i++)
scanf("%lld",&t[i]);
g[0]=1;
for (i=1;i<=2*n;i++)
g[i]=g[i-1]*i%maxn1;
c[1]=1;n--;
for (i=2;i<=n;i++)
c[i]=g[n+i-2]*mi(g[i-1],maxn1-2)%maxn1*mi(g[n-1],maxn1-2)%maxn1;
n++;
for (i=2;i<=n;i++){
ans=(ans+mi(b,n-1)*mi(a,n-i)%maxn1*c[n-i+1]%maxn1*t[i]%maxn1)%maxn1;
ans=(ans+mi(b,n-i)*mi(a,n-1)%maxn1*c[n-i+1]%maxn1*l[i]%maxn1)%maxn1;
}
printf("%lld\n",ans);
}