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>
int constexpr maxn = 28;
int constexpr maxm = maxn / 2;
long long constexpr mo = 1000000007;
long long fact[maxn];
long long pow3[maxm];
long long a[maxn];
long long bad[3];
int n, k;
void init_fact() {
  fact[0] = 1;
  for (int i = 1; i < maxn; i++) fact[i] = (fact[i - 1] * i) % mo;
}
void init_pow3() {
  pow3[0] = 1;
  for (int i = 1; i < maxm; i++) pow3[i] = pow3[i - 1] * 3;
}
using pair_type = std::pair<long long, long long>;
using key_type = pair_type;
struct key_hash {
  std::size_t operator()(key_type const& key) const {
    return std::hash<long long>()(key.first) ^
           (std::hash<long long>()(key.second) << 2);
  }
};
struct key_equal {
  bool operator()(key_type const& k1, key_type const& k2) const {
    return k1 == k2;
  }
};
long long calc(int u) {
  int lhalf = n / 2;
  int rhalf = n - lhalf;
  std::unordered_map<key_type, long long, key_hash, key_equal> right;
  for (int i = 0; i < (1 << rhalf); i++) {
    long long sum = 0, tot = 0;
    for (int j = 0; j < rhalf; j++)
      if ((i >> j) & 1) {
        sum += a[j + lhalf];
        tot++;
      }
    right[{sum, tot}]++;
  }
  long long ret = 0;
  for (int i = 0; i < (1 << lhalf); i++) {
    long long sum = 0, tot = 0;
    for (int j = 0; j < lhalf; j++)
      if ((i >> j) & 1) {
        sum += a[j];
        tot++;
      }
    if (sum > u) continue;
    for (int j = 0; j + tot <= n && j <= rhalf; j++) {
      auto tmp = right[{u - sum, j}];
      if (tmp) {
        long long ti = (fact[tot + j] * fact[n - tot - j]) % mo;
        ret = (ret + (tmp * ti) % mo) % mo;
      }
    }
  }
  return ret;
}
long long calc2(int u1, int u2) {
  u2 -= u1;
  int lhalf = n / 2;
  int rhalf = n - lhalf;
  std::unordered_map<
      key_type, std::unordered_map<key_type, long long, key_hash, key_equal>,
      key_hash, key_equal>
      right;
  for (int i = 0; i < pow3[rhalf]; i++) {
    long long sum1 = 0, tot1 = 0, sum2 = 0, tot2 = 0;
    for (int j = 0, t = i; t; j++, t /= 3) {
      if (t % 3 == 1) {
        sum1 += a[j + lhalf];
        tot1++;
      } else if (t % 3 == 2) {
        sum2 += a[j + lhalf];
        tot2++;
      }
    }
    right[{sum1, tot1}][{sum2, tot2}]++;
  }
  long long ret = 0;
  for (int i = 0; i < pow3[lhalf]; i++) {
    long long sum1 = 0, tot1 = 0, sum2 = 0, tot2 = 0;
    for (int j = 0, t = i; t; j++, t /= 3) {
      if (t % 3 == 1) {
        sum1 += a[j];
        tot1++;
      } else if (t % 3 == 2) {
        sum2 += a[j];
        tot2++;
      }
    }
    if (sum1 > u1 || sum2 > u2) continue;
    for (int j = 0; j + tot1 + tot2 <= n && j <= rhalf; j++) {
      if (right.find({u1 - sum1, j}) == right.end()) continue;
      for (int k = 0; k + j + tot1 + tot2 <= n && k <= rhalf; k++) {
        auto tmp = right[{u1 - sum1, j}][{u2 - sum2, k}];
        if (tmp) {
          long long ti = (((fact[tot1 + j] * fact[tot2 + k]) % mo) *
                          fact[n - tot1 - tot2 - j - k]) %
                         mo;
          ret = (ret + (tmp * ti)) % mo;
        }
      }
    }
  }
  return ret;
}
int main() {
  std::ios::sync_with_stdio(false);
  init_fact();
  init_pow3();
  std::cin >> n;
  for (int i = 0; i < n; i++) std::cin >> a[i];
  std::cin >> k;
  for (int i = 0; i < k; i++) std::cin >> bad[i];
  if (k == 2 && bad[0] > bad[1]) std::swap(bad[0], bad[1]);
  if (!k) {
    std::cout << fact[n] << '\n';
  } else if (k == 1) {
    long long ans = fact[n] - calc(bad[0]);
    ans = ((ans % mo) + mo) % mo;
    std::cout << ans << '\n';
  } else {
    long long ans =
        fact[n] - calc(bad[0]) - calc(bad[1]) + calc2(bad[0], bad[1]);
    ans = ((ans % mo) + mo) % mo;
    std::cout << ans << '\n';
  }
}