Problem: Iahub wants to meet his girlfriend Iahubina. They both live in Ox axis (the horizontal axis). Iahub lives at point 0 and Iahubina at point d.

Iahub has n positive integers a1, a2, ..., an. The sum of those numbers is d. Suppose p1, p2, ..., pn is a permutation of {1, 2, ..., n}. Then, let b1 = ap1, b2 = ap2 and so on. The array b is called a "route". There are n! different routes, one for each permutation p.

Iahub's travel schedule is: he walks b1 steps on Ox axis, then he makes a break in point b1. Then, he walks b2 more steps on Ox axis and makes a break in point b1 + b2. Similarly, at j-th (1 ≤ j ≤ n) time he walks bj more steps on Ox axis and makes a break in point b1 + b2 + ... + bj.

Iahub is very superstitious and has k integers which give him bad luck. He calls a route "good" if he never makes a break in a point corresponding to one of those k numbers. For his own curiosity, answer how many good routes he can make, modulo 1000000007 (109 + 7). 

Input

The first line contains an integer n (1 ≤ n ≤ 24). The following line contains n integers: a1, a2, ..., an (1 ≤ ai ≤ 109). 

The third line contains integer k (0 ≤ k ≤ 2). The fourth line contains k positive integers, representing the numbers that give Iahub bad luck. Each of these numbers does not exceed 109.

Output

Output a single integer — the answer of Iahub's dilemma modulo 1000000007 (109 + 7). 

Examples

Input

3
2 3 5
2
5 7


Output

1


Input

3
2 2 2
2
1 3


Output

6

Note

In the first case consider six possible orderings:

  * [2, 3, 5]. Iahub will stop at position 2, 5 and 10. Among them, 5 is bad luck for him. 
  * [2, 5, 3]. Iahub will stop at position 2, 7 and 10. Among them, 7 is bad luck for him. 
  * [3, 2, 5]. He will stop at the unlucky 5. 
  * [3, 5, 2]. This is a valid ordering. 
  * [5, 2, 3]. He got unlucky twice (5 and 7). 
  * [5, 3, 2]. Iahub would reject, as it sends him to position 5. 



In the second case, note that it is possible that two different ways have the identical set of stopping. In fact, all six possible ways have the same stops: [2, 4, 6], so there's no bad luck for Iahub.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 25;
const int M = 1000000007;
const int M1 = 341234291;
bool isprime(int x) {
  for (int i = 2; i * i <= x; ++i) {
    if (x % i == 0) return false;
  }
  return true;
}
int f[N];
void pre() {
  f[0] = 1;
  for (int i = 1; i < N; ++i) f[i] = (f[i - 1] * 1LL * i) % M;
}
int n;
int a[N];
int k;
int v[2];
int solv0() { return f[n]; }
int solv1() {
  map<long long, int> mp[N];
  for (int x = 0; x < (1 << (n / 2)); ++x) {
    int q = 0;
    long long s = 0;
    for (int i = 0; i < (n / 2); ++i) {
      if ((x & (1 << i))) {
        ++q;
        s += a[i];
      }
    }
    mp[q][s]++;
  }
  int ans = 0;
  for (int x = 0; x < (1 << (n / 2 + n % 2)); ++x) {
    int q = 0;
    long long s = 0;
    for (int i = 0; i < (n / 2 + n % 2); ++i) {
      if ((x & (1 << i))) {
        ++q;
        s += a[(n / 2) + i];
      }
    }
    for (int q0 = 0; q0 <= (n / 2); ++q0) {
      if (mp[q0].find(v[0] - s) != mp[q0].end()) {
        ans +=
            ((f[q + q0] * 1LL * f[n - q - q0]) % M * 1LL * mp[q0][v[0] - s]) %
            M;
        ans %= M;
      }
    }
  }
  return ans;
}
int solv2() {
  if (v[0] > v[1]) swap(v[0], v[1]);
  int z = 0;
  map<pair<long long, long long>, int> s;
  map<int, int> mp[N][N];
  for (int x = 0; x < (1 << (n / 2)); ++x) {
    for (int y = x;; y = (y - 1) & x) {
      long long s0 = 0, s1 = 0;
      int q0 = 0, q1 = 0;
      for (int i = 0; i < (n / 2); ++i) {
        if (x & (1 << i)) {
          s1 += a[i];
          if ((y & (1 << i))) {
            ++q0;
            s0 += a[i];
          } else
            ++q1;
        }
      }
      if (s.find(make_pair(s0, s1)) == s.end()) s[make_pair(s0, s1)] = ++z;
      int u = s[make_pair(s0, s1)];
      mp[q0][q1][u]++;
      if (y == 0) break;
    }
  }
  int ans = 0;
  for (int x = 0; x < (1 << (n / 2 + n % 2)); ++x) {
    for (int y = x;; y = (y - 1) & x) {
      long long s0 = 0, s1 = 0;
      int q0 = 0, q1 = 0;
      for (int i = 0; i < (n / 2 + n % 2); ++i) {
        if (x & (1 << i)) {
          s1 += a[i + n / 2];
          if ((y & (1 << i))) {
            ++q0;
            s0 += a[i + n / 2];
          } else
            ++q1;
        }
      }
      if (s.find(make_pair(v[0] - s0, v[1] - s1)) == s.end()) {
        if (y == 0) break;
        continue;
      }
      int u = s[make_pair(v[0] - s0, v[1] - s1)];
      for (int q0_ = 0; q0_ <= (n / 2); ++q0_) {
        for (int q1_ = 0; q0_ + q1_ <= (n / 2); ++q1_) {
          if (mp[q0_][q1_].find(u) != mp[q0_][q1_].end()) {
            ans += (((f[q0 + q0_] * 1LL * f[q1 + q1_]) % M * 1LL *
                     f[n - q0 - q0_ - q1 - q1_]) *
                    1LL * mp[q0_][q1_][u]) %
                   M;
            ans %= M;
          }
        }
      }
      if (y == 0) break;
    }
  }
  return ans;
}
void solv() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  scanf("%d", &k);
  for (int i = 0; i < k; ++i) scanf("%d", &v[i]);
  int ans;
  if (k == 0)
    ans = solv0();
  else if (k == 1) {
    ans = solv0();
    ans = (ans - solv1() + M) % M;
  } else {
    ans = solv0();
    ans = (ans - solv1() + M) % M;
    swap(v[0], v[1]);
    ans = (ans - solv1() + M) % M;
    ans = (ans + solv2()) % M;
  }
  printf("%d\n", ans);
}
int main() {
  pre();
  solv();
  return 0;
}