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 JAVA):

Solution:
import java.util.Map;
import java.io.StreamTokenizer;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		TokenizerReader in = new TokenizerReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class Pair<T> {
    final T t1, t2;

    Pair(T t1, T t2) {
        this.t1 = t1;
        this.t2 = t2;
    }

    public int hashCode() {
        return t1.hashCode() * 31013 + t2.hashCode();
    }

    public boolean equals(Object obj) {
        Pair<T> p = (Pair<T>) obj;
        return t1.equals(p.t1) && t2.equals(p.t2);
    }
}

class TaskE {
    final static long MOD = 1000000007;
    static long[] fact = new long[25];
    static {
        fact[0] = 1;
        for (int i = 1; i <= 24; ++i)
            fact[i] = fact[i-1] * i % MOD;
    }

    public void solve(@SuppressWarnings("UnusedParameters") int testNumber, TokenizerReader in, PrintWriter out) {
        int n = in.nextInt();

        int[] a = new int[n];
        for (int i = 0; i < n; ++i)
            a[i] = in.nextInt();
        long[] sums = new long[1<<n];
        Arrays.fill(sums, -1);
        sums[0] = 0;
        for (int i = 0; i < n; ++i)
            sums[1<<i] = a[i];
        for (int mask = 3; mask < 1<<n; ++mask)
            if (sums[mask] < 0) {
                int mask2 = mask & (mask-1);
                sums[mask] = sums[mask2] + sums[mask^mask2];
            }
        int nk = in.nextInt();
        if (nk == 0) {
            out.println(fact[n]);
            return;
        }
        long[] k = new long[nk];
        for (int i = 0; i < nk; ++i)
            k[i] = in.nextLong();
        Arrays.sort(k);
        if (nk == 2 && k[0] == k[1])
            nk = 1;

        long bothBad = 0;
        if (nk == 2 && n > 1) {
            HashMap<Pair<Long>, HashMap<Pair<Integer>, Integer> >
                    firstHalf = new HashMap<Pair<Long>, HashMap<Pair<Integer>, Integer>>();
            final int half = (n+1)/2;
            int maxMask = 1;
            for (int i = 0; i < half; ++i)
                maxMask *= 3;
            for (int mask = 0; mask < maxMask; ++mask) {
                int curMask = mask;
                int mask1 = 0, mask2 = 0;
                for (int i = 0; i < half; ++i) {
                    int part = curMask % 3;
                    curMask /= 3;
                    if (part == 0)
                        mask1 |= (1<<i);
                    else if (part == 1)
                        mask2 |= (1<<i);
                }
                Pair<Long> s = new Pair<Long>(sums[mask1], sums[mask2]);
                Pair<Integer> c = new Pair<Integer>(Integer.bitCount(mask1), Integer.bitCount(mask2));

                HashMap<Pair<Integer>, Integer> m = firstHalf.get(s);
                if (m == null) {
                    m = new HashMap<Pair<Integer>, Integer>();
                    firstHalf.put(s, m);
                }
                Integer cc = m.get(c);
                if (cc == null)
                    m.put(c, 1);
                else
                    m.put(c, cc + 1);

            }
            long diff = k[1] - k[0];
            if (n - half != half)
                maxMask /= 3;
            for (int mask = 0; mask < maxMask; ++mask) {
                int curMask = mask;
                int mask1 = 0, mask2 = 0;
                for (int i = 0; i < n - half; ++i) {
                    int part = curMask % 3;
                    curMask /= 3;
                    if (part == 0)
                        mask1 |= (1<<i);
                    else if (part == 1)
                        mask2 |= (1<<i);
                }
                int cnt1 = Integer.bitCount(mask1);
                int cnt2 = Integer.bitCount(mask2);
                long s1 = k[0] - sums[mask1 << half];
                long s2 = diff - sums[mask2 << half];
                Pair<Long> s = new Pair<Long>(s1, s2);
                HashMap<Pair<Integer>, Integer> m = firstHalf.get(s);
                if (m != null) {
                    for (Map.Entry<Pair<Integer>, Integer> e : m.entrySet()) {
                        int c = e.getValue();
                        int part1 = e.getKey().t1 + cnt1;
                        int part2 = e.getKey().t2 + cnt2;
                        long tmp = fact[part1] * fact[part2] % MOD;
                        tmp = tmp * fact[n-part1-part2] % MOD;
                        bothBad = (bothBad + c * tmp) % MOD;
                    }
                }
            }
        }


        long total = fact[n], bad = 0;
        for (int mask = 0; mask < 1<<n; ++mask) {
            if (k[0] == sums[mask]) {
                int c1 = Integer.bitCount(mask);
                bad = (bad + fact[c1] * fact[n-c1]) % MOD;
            } else if (nk == 2 && k[1] == sums[mask]) {
                int c1 = Integer.bitCount(mask);
                bad = (bad + fact[c1] * fact[n-c1]) % MOD;
            }
        }

        long res = (total + MOD - bad + bothBad) % MOD;
        out.println(res);
    }
}

class TokenizerReader extends StreamTokenizer {
    public TokenizerReader(InputStream in) {
        super(new BufferedReader(new InputStreamReader(in)));
        defaultConfig();
    }

    public String nextString() {
        try {
            nextToken();
        } catch (IOException e) {
            throw new RuntimeException("nextString: exception in line " + lineno(), e);
        }
        return sval;
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

    public long nextLong() {
        return Long.parseLong(nextString());
    }

    public void defaultConfig() {
        resetSyntax();
        wordChars(33, 126);
        whitespaceChars(0, ' ');
    }

    }