from __future__ import division,print_function
from heapq import*
import sys
le = sys.__stdin__.read().split("\n")[::-1]
mo=10**9+7
def bourrin(a,b):
    k=0
    ac=a[:]
    while k<len(b):
        if a[k]>a[k+1]-b[k]+10**-9:
            a[k],a[k+1]=(a[k]+a[k+1]-b[k])/2,(a[k]+a[k+1]+b[k])/2
            if k>0:
                k-=1
        else:
            k+=1
    return a[0]
def clever(a,b):#not a solution but still an improvement, it's the magical formula which will make everything work
    return min((sum(a[:r+1])-sum(k*b[r-k] for k in range(1,r+1)))/(r+1) for r in range(0,len(a)))
if 1:
    n=int(le.pop())
    c = list(map(int,le.pop().split()))
    b = list(map(int,le.pop().split()))
    le.pop()
    x=int(le.pop())
    prefb=[b[0]]
    for k in b[1:]:
        prefb.append(k+prefb[-1])
    prefb.append(0)    #careful when going to C
    prefbt=[0]
    for k in range(1,n-1):
        prefbt.append(k*b[k]+prefbt[-1])
    prefbt.append(0)
"""def f(index,pref_sum):
    global x
    if index==-1:
        return int(pref_sum==0)
    cl=(index,pref_sum)
    if not(cl in d):
        #if (pref_sum-sum((index-k)*b[k] for k in range(index)))/(index+1)<x:
        if (pref_sum-index*prefb[index-1]+prefbt[index-1])/(index+1)<x:
            return 0
        else:
            d[cl]=sum(f(index-1,pref_sum-k) for k in range(c[index]+1))
    return d[cl]"""
sc=sum(c)
d=[[0]*(sc+1) for k in range(n+1)]#fuck a lot of prefix sum in this problem
ds=[[0]*(sc+2) for k in range(n+1)]#prefix array beginning with 0
ds[-1]=list(range(sc+2))
d[-1]=[1]*(sc+1)
for index in range(n-1,-1,-1):
    #can even go linearly for minpref
    minpref=0
    while (minpref-index*prefb[index-1]+prefbt[index-1])/(index+1)<x:
       minpref+=1

    for pref in range(sc+1):
        d[index][pref]=max(0,ds[index+1][min(pref+c[index]+1,sc+1)]-ds[index+1][max(minpref,pref)])
    for pref in range(1,sc+2):
        ds[index][pref]=(ds[index][pref-1]+d[index][pref-1])%mo

def co(index,lis):
    if index==len(c):
        return [lis]
    else:
        r=[]
        for k in range(c[index]+1):
            r+=co(index+1,lis+[k])
        return r
#print(sum(f(n-1,pref_sum) for pref_sum in range(0,sum(c)+1))%mo)
print(d[0][0]%mo)
