Problem: This is an easier version of the problem. In this version, n ≤ 6.

Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the testcases.

Marek chooses an integer n and n^2 integers p_{ij} (1 ≤ i ≤ n, 1 ≤ j ≤ n). He then generates a random bipartite graph with 2n vertices. There are n vertices on the left side: ℓ_1, ℓ_2, ..., ℓ_n, and n vertices on the right side: r_1, r_2, ..., r_n. For each i and j, he puts an edge between vertices ℓ_i and r_j with probability p_{ij} percent.

It turns out that the tests will be strong only if a perfect matching exists in the generated graph. What is the probability that this will occur?

It can be shown that this value can be represented as P/Q where P and Q are coprime integers and Q not≡ 0 \pmod{10^9+7}. Let Q^{-1} be an integer for which Q ⋅ Q^{-1} ≡ 1 \pmod{10^9+7}. Print the value of P ⋅ Q^{-1} modulo 10^9+7.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 6). The following n lines describe the probabilities of each edge appearing in the graph. The i-th of the lines contains n integers p_{i1}, p_{i2}, ..., p_{in} (0 ≤ p_{ij} ≤ 100); p_{ij} denotes the probability, in percent, of an edge appearing between ℓ_i and r_j.

Output

Print a single integer — the probability that the perfect matching exists in the bipartite graph, written as P ⋅ Q^{-1} \pmod{10^9+7} for P, Q defined above.

Examples

Input


2
50 50
50 50


Output


937500007


Input


3
3 1 4
1 5 9
2 6 5


Output


351284554

Note

In the first sample test, each of the 16 graphs below is equally probable. Out of these, 7 have a perfect matching:

<image>

Therefore, the probability is equal to 7/16. As 16 ⋅ 562 500 004 = 1 \pmod{10^9+7}, the answer to the testcase is 7 ⋅ 562 500 004 mod{(10^9+7)} = 937 500 007.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
inline long long mul(const long long& a, const long long& b) {
  return (a * b) % mod;
}
inline long long add(const long long& a, const long long& b) {
  return (a + b + mod) % mod;
}
inline void upd(long long& a, const long long& b) { a = (a + b + mod) % mod; }
inline bool has(int x, int i) { return (x & (1 << i)) > 0; }
long long pwr(const long long& a, const long long& b) {
  if (!b) return 1;
  long long h = pwr(a, b >> 1);
  return mul(mul(h, h), ((b & 1) ? a : 1));
}
const int n = 6, k = (n * (n - 1) * (n - 2)) / 6, i100 = pwr(100, mod - 2);
vector<int> num(1 << n, -1), mask;
vector<vector<long long> > p(2, vector<long long>((1 << k), 0));
int find_matchings(int& g, int x) {
  int ans = 0;
  for (int l0 = 0; l0 < n; l0++)
    for (int l1 = 0; l1 < n; l1++)
      for (int l2 = 0; l2 < n; l2++)
        if (l0 != l1 && l1 != l2 && l0 != l2 && has(g, l0) && has(g, n + l1) &&
            has(g, 2 * n + l2))
          ans |= (1 << num[x ^ (1 << l0) ^ (1 << l1) ^ (1 << l2)]);
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < (1 << n); i++) {
    int c = 0;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) c++;
    if (c == n / 2) num[i] = mask.size(), mask.push_back(i);
  }
  int m;
  cin >> m;
  vector<long long> pe(n * n, 0);
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++) cin >> pe[i * n + j];
  for (int i = m; i < n; i++) pe[i * n + i] = 100;
  for (int i = 0; i < n * n; i++) pe[i] = mul(pe[i], i100);
  int e = n * (n / 2);
  for (int c = 0; c < 2; c++)
    for (int i = 0; i < (1 << e); i++) {
      long long pr = 1;
      for (int j = 0; j < e; j++)
        if (has(i, j))
          pr = mul(pr, pe[c * e + j]);
        else
          pr = mul(pr, add(1, -pe[c * e + j]));
      int mask = find_matchings(i, c * ((1 << n) - 1));
      upd(p[c][mask], pr);
    }
  for (int i = 0; i < k; i++)
    for (int mask = 0; mask < (1 << k); mask++)
      if (has(mask, i)) upd(p[1][mask], p[1][mask ^ (1 << i)]);
  long long ans = 0;
  for (int mask = 0; mask < (1 << k); mask++)
    upd(ans, mul(p[0][mask], p[1][((1 << k) - 1) ^ mask]));
  cout << add(1, -ans) << "\n";
  return 0;
}