#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '{';
  string sep;
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename T, size_t size>
ostream &operator<<(ostream &os, const array<T, size> &arr) {
  os << '{';
  string sep;
  for (const auto &x : arr) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
void dbg_out() { cout << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cout << ' ' << H;
  dbg_out(T...);
}
const int N = 15, mod = 1e9 + 7, bit = 61;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}
template <const int &MOD>
struct _m_int {
  int val;
  _m_int(int64_t v = 0) {
    if (v < 0) v = v % MOD + MOD;
    if (v >= MOD) v %= MOD;
    val = v;
  }
  static int mod_inv(int a, int m = MOD) {
    int g = m, r = a, x = 0, y = 1;
    while (r != 0) {
      int q = g / r;
      g %= r;
      swap(g, r);
      x -= q * y;
      swap(x, y);
    }
    return x < 0 ? x + m : x;
  }
  explicit operator int() const { return val; }
  explicit operator int64_t() const { return val; }
  _m_int &operator+=(const _m_int &other) {
    val -= MOD - other.val;
    if (val < 0) val += MOD;
    return *this;
  }
  _m_int &operator-=(const _m_int &other) {
    val -= other.val;
    if (val < 0) val += MOD;
    return *this;
  }
  static unsigned fast_mod(uint64_t x, unsigned m = MOD) {
    return x % m;
    unsigned x_high = x >> 32, x_low = (unsigned)x;
    unsigned quot, rem;
    asm("divl %4\n" : "=a"(quot), "=d"(rem) : "d"(x_high), "a"(x_low), "r"(m));
    return rem;
  }
  _m_int &operator*=(const _m_int &other) {
    val = fast_mod((uint64_t)val * other.val);
    return *this;
  }
  _m_int &operator/=(const _m_int &other) { return *this *= other.inv(); }
  friend _m_int operator+(const _m_int &a, const _m_int &b) {
    return _m_int(a) += b;
  }
  friend _m_int operator-(const _m_int &a, const _m_int &b) {
    return _m_int(a) -= b;
  }
  friend _m_int operator*(const _m_int &a, const _m_int &b) {
    return _m_int(a) *= b;
  }
  friend _m_int operator/(const _m_int &a, const _m_int &b) {
    return _m_int(a) /= b;
  }
  _m_int &operator++() {
    val = val == MOD - 1 ? 0 : val + 1;
    return *this;
  }
  _m_int &operator--() {
    val = val == 0 ? MOD - 1 : val - 1;
    return *this;
  }
  _m_int operator++(int) {
    _m_int before = *this;
    ++*this;
    return before;
  }
  _m_int operator--(int) {
    _m_int before = *this;
    --*this;
    return before;
  }
  _m_int operator-() const { return val == 0 ? 0 : MOD - val; }
  bool operator==(const _m_int &other) const { return val == other.val; }
  bool operator!=(const _m_int &other) const { return val != other.val; }
  bool operator<(const _m_int &other) const { return val < other.val; }
  bool operator<=(const _m_int &other) const { return val <= other.val; }
  bool operator>(const _m_int &other) const { return val > other.val; }
  bool operator>=(const _m_int &other) const { return val >= other.val; }
  _m_int inv() const { return mod_inv(val); }
  _m_int pow(int64_t p) const {
    if (p < 0) return inv().pow(-p);
    _m_int a = *this, result = 1;
    while (p > 0) {
      if (p & 1) {
        result *= a;
      }
      a *= a;
      p >>= 1;
    }
    return result;
  }
  friend ostream &operator<<(ostream &os, const _m_int &m) {
    return os << m.val;
  }
};
extern const int MOD = 1e9 + 7;
using mod_int = _m_int<MOD>;
mod_int dp[(1 << N)];
bool vis[(1 << N)];
mod_int prob[N][N];
int n, a[N];
mod_int solve(int mask) {
  if (__builtin_popcountll(mask) <= 1) {
    return 1;
  }
  if (__builtin_popcountll(mask) == 2) {
    return 0;
  }
  if (vis[mask]) {
    return dp[mask];
  }
  vis[mask] = 1;
  mod_int ans = 1;
  for (int submask = mask; submask; submask = (submask - 1) & mask) {
    if (submask == mask) {
      continue;
    }
    mod_int curr = solve(submask);
    for (int x = 0; x < n; x++) {
      if (!(submask >> x & 1)) {
        continue;
      }
      int loserMask = mask ^ submask;
      for (int y = 0; y < n; y++) {
        if (!(loserMask >> y & 1)) {
          continue;
        }
        curr *= prob[x][y];
      }
    }
    ans -= curr;
  }
  return dp[mask] = ans;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t = 1;
  for (long long tc = 1; tc <= t; tc++) {
    cin >> n;
    for (long long i = 0; i <= n - 1; i++) {
      cin >> a[i];
    }
    for (long long i = 0; i <= n - 1; i++) {
      for (long long j = 0; j <= n - 1; j++) {
        prob[i][j] = ((mod_int)a[i]) / (mod_int)(a[i] + a[j]);
      }
    }
    mod_int ans = 0;
    memset(vis, 0, sizeof(vis));
    for (int mask = 0; mask < (1 << n); mask++) {
      mod_int together = solve(mask);
      for (int i = 0; i < n; i++) {
        if (mask >> i & 1) {
          for (int j = 0; j < n; j++) {
            if (mask >> j & 1) {
              continue;
            }
            together *= prob[i][j];
          }
        }
      }
      mod_int curr = __builtin_popcountll(mask) * together;
      ans += curr;
    }
    cout << ans << endl;
  }
  return 0;
}

### Prompt

Create a solution in cpp for the following problem:

<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.

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '{';
  string sep;
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename T, size_t size>
ostream &operator<<(ostream &os, const array<T, size> &arr) {
  os << '{';
  string sep;
  for (const auto &x : arr) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
void dbg_out() { cout << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cout << ' ' << H;
  dbg_out(T...);
}
const int N = 15, mod = 1e9 + 7, bit = 61;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}
template <const int &MOD>
struct _m_int {
  int val;
  _m_int(int64_t v = 0) {
    if (v < 0) v = v % MOD + MOD;
    if (v >= MOD) v %= MOD;
    val = v;
  }
  static int mod_inv(int a, int m = MOD) {
    int g = m, r = a, x = 0, y = 1;
    while (r != 0) {
      int q = g / r;
      g %= r;
      swap(g, r);
      x -= q * y;
      swap(x, y);
    }
    return x < 0 ? x + m : x;
  }
  explicit operator int() const { return val; }
  explicit operator int64_t() const { return val; }
  _m_int &operator+=(const _m_int &other) {
    val -= MOD - other.val;
    if (val < 0) val += MOD;
    return *this;
  }
  _m_int &operator-=(const _m_int &other) {
    val -= other.val;
    if (val < 0) val += MOD;
    return *this;
  }
  static unsigned fast_mod(uint64_t x, unsigned m = MOD) {
    return x % m;
    unsigned x_high = x >> 32, x_low = (unsigned)x;
    unsigned quot, rem;
    asm("divl %4\n" : "=a"(quot), "=d"(rem) : "d"(x_high), "a"(x_low), "r"(m));
    return rem;
  }
  _m_int &operator*=(const _m_int &other) {
    val = fast_mod((uint64_t)val * other.val);
    return *this;
  }
  _m_int &operator/=(const _m_int &other) { return *this *= other.inv(); }
  friend _m_int operator+(const _m_int &a, const _m_int &b) {
    return _m_int(a) += b;
  }
  friend _m_int operator-(const _m_int &a, const _m_int &b) {
    return _m_int(a) -= b;
  }
  friend _m_int operator*(const _m_int &a, const _m_int &b) {
    return _m_int(a) *= b;
  }
  friend _m_int operator/(const _m_int &a, const _m_int &b) {
    return _m_int(a) /= b;
  }
  _m_int &operator++() {
    val = val == MOD - 1 ? 0 : val + 1;
    return *this;
  }
  _m_int &operator--() {
    val = val == 0 ? MOD - 1 : val - 1;
    return *this;
  }
  _m_int operator++(int) {
    _m_int before = *this;
    ++*this;
    return before;
  }
  _m_int operator--(int) {
    _m_int before = *this;
    --*this;
    return before;
  }
  _m_int operator-() const { return val == 0 ? 0 : MOD - val; }
  bool operator==(const _m_int &other) const { return val == other.val; }
  bool operator!=(const _m_int &other) const { return val != other.val; }
  bool operator<(const _m_int &other) const { return val < other.val; }
  bool operator<=(const _m_int &other) const { return val <= other.val; }
  bool operator>(const _m_int &other) const { return val > other.val; }
  bool operator>=(const _m_int &other) const { return val >= other.val; }
  _m_int inv() const { return mod_inv(val); }
  _m_int pow(int64_t p) const {
    if (p < 0) return inv().pow(-p);
    _m_int a = *this, result = 1;
    while (p > 0) {
      if (p & 1) {
        result *= a;
      }
      a *= a;
      p >>= 1;
    }
    return result;
  }
  friend ostream &operator<<(ostream &os, const _m_int &m) {
    return os << m.val;
  }
};
extern const int MOD = 1e9 + 7;
using mod_int = _m_int<MOD>;
mod_int dp[(1 << N)];
bool vis[(1 << N)];
mod_int prob[N][N];
int n, a[N];
mod_int solve(int mask) {
  if (__builtin_popcountll(mask) <= 1) {
    return 1;
  }
  if (__builtin_popcountll(mask) == 2) {
    return 0;
  }
  if (vis[mask]) {
    return dp[mask];
  }
  vis[mask] = 1;
  mod_int ans = 1;
  for (int submask = mask; submask; submask = (submask - 1) & mask) {
    if (submask == mask) {
      continue;
    }
    mod_int curr = solve(submask);
    for (int x = 0; x < n; x++) {
      if (!(submask >> x & 1)) {
        continue;
      }
      int loserMask = mask ^ submask;
      for (int y = 0; y < n; y++) {
        if (!(loserMask >> y & 1)) {
          continue;
        }
        curr *= prob[x][y];
      }
    }
    ans -= curr;
  }
  return dp[mask] = ans;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t = 1;
  for (long long tc = 1; tc <= t; tc++) {
    cin >> n;
    for (long long i = 0; i <= n - 1; i++) {
      cin >> a[i];
    }
    for (long long i = 0; i <= n - 1; i++) {
      for (long long j = 0; j <= n - 1; j++) {
        prob[i][j] = ((mod_int)a[i]) / (mod_int)(a[i] + a[j]);
      }
    }
    mod_int ans = 0;
    memset(vis, 0, sizeof(vis));
    for (int mask = 0; mask < (1 << n); mask++) {
      mod_int together = solve(mask);
      for (int i = 0; i < n; i++) {
        if (mask >> i & 1) {
          for (int j = 0; j < n; j++) {
            if (mask >> j & 1) {
              continue;
            }
            together *= prob[i][j];
          }
        }
      }
      mod_int curr = __builtin_popcountll(mask) * together;
      ans += curr;
    }
    cout << ans << endl;
  }
  return 0;
}

```