description: <image>
  
  William is not only interested in trading but also in betting on sports matches. n teams participate in each match. Each team is characterized by strength a_i. Each two teams i < j play with each other exactly once. Team i wins with probability (a_i)/(a_i + a_j) and team j wins with probability (a_j)/(a_i + a_j).
  
  The team is called a winner if it directly or indirectly defeated all other teams. Team a defeated (directly or indirectly) team b if there is a sequence of teams c_1, c_2, ... c_k such that c_1 = a, c_k = b and team c_i defeated team c_{i + 1} for all i from 1 to k - 1. Note that it is possible that team a defeated team b and in the same time team b defeated team a.
  
  William wants you to find the expected value of the number of winners.
  
  Input
  
  The first line contains a single integer n (1 ≤ n ≤ 14), which is the total number of teams participating in a match.
  
  The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^6) — the strengths of teams participating in a match.
  
  Output
  
  Output a single integer — the expected value of the number of winners of the tournament modulo 10^9 + 7.
  
  Formally, let M = 10^9+7. It can be demonstrated that the answer can be presented as a irreducible fraction p/q, where p and q are integers and q not ≡ 0 \pmod{M}. Output a single integer equal to p ⋅ q^{-1} mod M. In other words, output an integer x such that 0 ≤ x < M and x ⋅ q ≡ p \pmod{M}.
  
  Examples
  
  Input
  
  
  2
  1 2
  
  
  Output
  
  
  1
  
  
  Input
  
  
  5
  1 5 2 11 14
  
  
  Output
  
  
  642377629
  
  Note
  
  To better understand in which situation several winners are possible let's examine the second test:
  
  One possible result of the tournament is as follows (a → b means that a defeated b):
  
    * 1 → 2 
    * 2 → 3 
    * 3 → 1 
    * 1 → 4 
    * 1 → 5 
    * 2 → 4 
    * 2 → 5 
    * 3 → 4 
    * 3 → 5 
    * 4 → 5 
  
  
  
  Or more clearly in the picture:
  
  <image>
  
  In this case every team from the set \{ 1, 2, 3 \} directly or indirectly defeated everyone. I.e.:
  
    * 1st defeated everyone because they can get to everyone else in the following way 1 → 2, 1 → 2 → 3, 1 → 4, 1 → 5. 
    * 2nd defeated everyone because they can get to everyone else in the following way 2 → 3, 2 → 3 → 1, 2 → 4, 2 → 5. 
    * 3rd defeated everyone because they can get to everyone else in the following way 3 → 1, 3 → 1 → 2, 3 → 4, 3 → 5. 
  
  
  
  Therefore the total number of winners is 3.
solution: #include <bits/stdc++.h>
  #pragma GCC optimize("O3")
  using namespace std;
  template <class L, class R>
  ostream &operator<<(ostream &os, map<L, R> P) {
    for (auto const &vv : P) os << "(" << vv.first << "," << vv.second << ")";
    return os;
  }
  template <class T>
  ostream &operator<<(ostream &os, set<T> V) {
    os << "[";
    for (auto const &vv : V) os << vv << ",";
    os << "]";
    return os;
  }
  template <class T>
  ostream &operator<<(ostream &os, vector<T> V) {
    os << "[";
    for (auto const &vv : V) os << vv << ",";
    os << "]";
    return os;
  }
  template <class L, class R>
  ostream &operator<<(ostream &os, pair<L, R> P) {
    os << "(" << P.first << "," << P.second << ")";
    return os;
  }
  inline int fstoi(const string &str) {
    auto it = str.begin();
    bool neg = 0;
    int num = 0;
    if (*it == '-')
      neg = 1;
    else
      num = *it - '0';
    ++it;
    while (it < str.end()) num = num * 10 + (*it++ - '0');
    if (neg) num *= -1;
    return num;
  }
  inline void getch(char &x) {
    while (x = getchar_unlocked(), x < 33) {
      ;
    }
  }
  inline void getstr(string &str) {
    str.clear();
    char cur;
    while (cur = getchar_unlocked(), cur < 33) {
      ;
    }
    while (cur > 32) {
      str += cur;
      cur = getchar_unlocked();
    }
  }
  template <typename T>
  inline bool sc(T &num) {
    bool neg = 0;
    int c;
    num = 0;
    while (c = getchar_unlocked(), c < 33) {
      if (c == EOF) return false;
    }
    if (c == '-') {
      neg = 1;
      c = getchar_unlocked();
    }
    for (; c > 47; c = getchar_unlocked()) num = num * 10 + c - 48;
    if (neg) num *= -1;
    return true;
  }
  template <typename T, typename... Args>
  inline void sc(T &num, Args &...args) {
    bool neg = 0;
    int c;
    num = 0;
    while (c = getchar_unlocked(), c < 33) {
      ;
    }
    if (c == '-') {
      neg = 1;
      c = getchar_unlocked();
    }
    for (; c > 47; c = getchar_unlocked()) num = num * 10 + c - 48;
    if (neg) num *= -1;
    sc(args...);
  }
  constexpr int64_t mod = 1e9 + 7;
  int64_t fac[2000001];
  int64_t facinv[2000001];
  void pre() {
    fac[0] = 1;
    for (int i = (1); i < int((2000001)); ++i) fac[i] = fac[i - 1] * i % mod;
    facinv[2000001 - 1] = 407182070;
    for (int i = 2000001 - 2; i >= 0; --i)
      facinv[i] = facinv[i + 1] * (i + 1) % mod;
  }
  int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    pre();
    int64_t n;
    sc(n);
    int64_t a[n];
    for (auto &i : (a)) sc(i);
    int64_t res = 0;
    int64_t dp[1 << n];
    int64_t dp2[1 << n];
    int bits[32], othbits[32];
    for (int i = (1); i < int((1 << n)); ++i) {
      ;
      int crm = (i - 1) & i;
      dp[i] = 0;
      crm = (i - 1) & i;
      for (; crm;) {
        int64_t comp[14];
        memset(comp, -1, 14 << 3);
        int64_t cr = 1;
        for (int x = (0); x < int((14)); ++x) {
          if (crm & (1 << x)) {
            if (comp[x] == -1) {
              comp[x] = 1;
              for (int j = (0); j < int((14)); ++j) {
                if ((i & (1 << j)) && !(crm & (1 << j))) {
                  comp[x] *= (int64_t)(a[x]) * facinv[a[x] + a[j]] % mod *
                             fac[a[x] + a[j] - 1] % mod;
                  comp[x] %= mod;
                }
              }
            }
            cr *= comp[x];
            cr %= mod;
          }
        };
        ;
        cr *= 1 - dp[crm];
        cr %= mod;
        dp[i] += cr;
        dp[i] %= mod;
        ;
        if (i == ((1 << n) - 1)) {
          ;
          ;
          res += (int64_t)__builtin_popcount(crm) * cr;
          res %= mod;
        }
        crm = (crm - 1) & i;
      }
    };
    ;
    ;
    res += (int64_t)n * (1 - dp[(1 << n) - 1]);
    res %= mod;
    res += mod;
    res %= mod;
    cout << res << '\n';
  }
  