#include <bits/stdc++.h>
using namespace std;
const long long maxl = 105, maxs = 10005, mod = 1e9 + 7;
long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -w;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = (s << 1) + (s << 3) + (ch ^ '0');
    ch = getchar();
  }
  return s * w;
}
long long n, l, r, L, ans;
long long c[maxl], b[maxl], pre[maxl], f[maxl][maxs];
void chksum(long long x, long long &y) { y = (x + y) % mod; }
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) c[i] = read();
  for (long long i = 1; i <= n; i++) b[i] = read(), pre[i] = pre[i - 1] + b[i];
  L = read();
  f[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    l += (L + pre[i - 1]), r += c[i];
    for (long long j = max(l, 0ll); j <= r; j++) {
      for (long long k = 0; k <= min(j, c[i]); k++)
        chksum(f[i - 1][j - k], f[i][j]);
    }
  }
  for (long long i = 1; i <= r; i++) chksum(f[n][i], ans);
  cout << ans << endl;
  return 0;
}
