# Description

G系共有n位同学，M门必修课。这N位同学的编号为0到N-1的整数，其中B神的编号为0号。这M门必修课编号为0到M-
1的整数。一位同学在必修课上可以获得的分数是1到Ui中的一个整数。如果在每门课上A获得的成绩均小于等于B获

0^9+7的余数就可以了。

# Input

≤Ri≤N。数据保证至少有1种情况使得B神说的话成立。N<=100,M<=100,Ui<=10^9

3 2 1

2 2

1 2

10

# 分析

(s+1)^k-s^k=c(k,1)*s^(k-1) +c(k,2)*s^(k-2) +…+c(k,k)*s^0

s^k-(s-1)^k=c(k,1)(s-1)^(k-1)+c(k,2)(s-1)^(k-2)+…+c(k,k)*(s-1)^0

………………………………………………………………………………………………

  2^k-1^k=c(k,1)*1^(k-1)     +c(k,2)*1^(k-2)     +...+c(k,k)*1^0


(s+1)^k-1=c(k,1)*g(k-1)+c(k,2)*g(k-2)+…+c(k,k)*g(0)

# 代码

#include <bits/stdc++.h>

typedef long long LL;

const int N = 105;
const int MOD = 1e9 + 7;

int n,m,k,jc[N],ny[N],po1[N],po2[N],f[N],u[N],r[N],g[N];

int ksm(int x,int y)
{
int ans = 1;
while (y)
{
if (y & 1)
ans = 1ll * ans * x % MOD;
x = 1ll * x * x % MOD;
y >>= 1;
}
return ans;
}

int C(int n,int m)
{
if (n < m)
return 0;
return 1ll * jc[n] * ny[m] % MOD * ny[n - m] % MOD;
}

int calc(int u,int r)
{
for (int i = 0; i <= n + 1; i++)
po1[i] = ksm(i,r - 1), po2[i] = ksm(i,n - r);
for (int i = 1; i <= n + 1; i++)
{
f[i] = 0;
for (int j = 1; j <= i; j++)
(f[i] += 1ll * po1[i - j] * po2[j] % MOD) %= MOD;
}
int ans = 0;
for (int i = 1; i <= n + 1; i++)
{
int s1 = f[i], s2 = 1;
for (int j = 1; j <= n + 1; j++)
if (i != j)
s1 = 1ll * s1 * (u - j) % MOD, s2 = 1ll * s2 * (i - j) % MOD;
(ans += 1ll * s1 * ksm(s2, MOD - 2) % MOD) %= MOD;
}
return ans;
}

int main()
{
scanf("%d%d%d",&n,&m,&k);
for (int i = 1; i <= m; i++)
scanf("%d",&u[i]);
for (int i = 1; i <= m; i++)
scanf("%d",&r[i]);
jc[0] = jc[1] = ny[0] = ny[1] = 1;
for (int i = 2; i <= n; i++)
jc[i] = 1ll * jc[i - 1] * i % MOD, ny[i] = 1ll * (MOD - MOD / i) * ny[MOD % i] % MOD;
for (int i = 2; i <= n; i++)
ny[i] = 1ll * ny[i] * ny[i - 1] % MOD;
for (int i = 1; i <= m; i++)
g[i] = calc(u[i],r[i]);
int ans = 0;
for (int i = k; i < n; i++)
{
int w = 1ll * C(n - 1, i) * C(i, k) % MOD;
for (int j = 1; j <= m; j++)
w = 1ll * w * C(n - i - 1, r[j] - 1) % MOD * g[j] % MOD;
if ((i - k) & 1)
(ans -= w) %= MOD;
else (ans += w) %= MOD;
}
printf("%d",(ans + MOD) % MOD);
}