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 int inf = (int)1.01e9;
const long long infll = (long long)1.01e18;
const long double eps = 1e-9;
const long double pi = acos((long double)-1);
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int x) { return mrand() % x; }
void precalc() {}
const int mod = (int)1e9 + 7;
int mul(int a, int b) { return (long long)a * b % mod; }
void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
pair<int, int> gcd(int a, int b) {
  if (!b) {
    return make_pair(1, 0);
  }
  pair<int, int> p = gcd(b, a % b);
  return make_pair(p.second, p.first - (a / b) * p.second);
}
int inv(int x) {
  int res = gcd(x, mod).first % mod;
  if (res < 0) {
    res += mod;
  }
  return res;
}
const int maxn = 6;
int n;
int ps[maxn][maxn];
int qs[maxn][maxn];
bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &ps[i][j]);
    }
  }
  return true;
}
const int pown = (1 << maxn);
int ids[pown];
vector<int> msks;
vector<pair<int, int>> es;
vector<int> a, b;
int can[maxn][maxn];
void genMsk(int i, int k, int cur, bool inv, int &msk) {
  if (i >= k) {
    if (inv) {
      cur = (((1 << n) - 1) ^ cur);
    }
    assert(ids[cur] != -1);
    msk |= (1 << ids[cur]);
    return;
  }
  for (int j = 0; j < n; j++) {
    if (!can[i][j] || (cur & (1 << j))) {
      continue;
    }
    genMsk(i + 1, k, (cur | (1 << j)), inv, msk);
  }
}
void solve() {
  {
    int tomul = inv(100);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        ps[i][j] = mul(ps[i][j], tomul);
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        qs[i][j] = 1;
        add(qs[i][j], mod - ps[i][j]);
      }
    }
  }
  int k = n / 2;
  {
    msks.clear();
    for (int i = 0; i < (1 << n); i++) {
      ids[i] = -1;
      if (__builtin_popcount(i) == k) {
        ids[i] = ((int)(msks).size());
        msks.push_back(i);
      }
    }
  }
  es.clear();
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < n; j++) {
      es.push_back(make_pair(i, j));
    }
  }
  a.clear();
  a.resize(1 << ((int)(msks).size()));
  for (int i = 0; i < (1 << ((int)(es).size())); i++) {
    int p = 1, msk = 0;
    for (int j = 0; j < ((int)(es).size()); j++) {
      int v = es[j].first, u = es[j].second;
      can[v][u] = false;
      if (i & (1 << j)) {
        can[v][u] = true;
        p = mul(p, ps[v][u]);
      } else {
        p = mul(p, qs[v][u]);
      }
    }
    genMsk(0, k, 0, false, msk);
    add(a[msk], p);
  }
  es.clear();
  for (int i = k; i < n; i++) {
    for (int j = 0; j < n; j++) {
      es.push_back(make_pair(i, j));
    }
  }
  b.clear();
  b.resize(1 << ((int)(msks).size()));
  for (int i = 0; i < (1 << ((int)(es).size())); i++) {
    int p = 1, msk = 0;
    for (int j = 0; j < ((int)(es).size()); j++) {
      int v = es[j].first, u = es[j].second;
      can[v][u] = false;
      if (i & (1 << j)) {
        can[v][u] = true;
        p = mul(p, ps[v][u]);
      } else {
        p = mul(p, qs[v][u]);
      }
    }
    genMsk(k, n, 0, true, msk);
    add(b[msk], p);
  }
  for (int j = 0; j < ((int)(msks).size()); j++) {
    for (int i = 0; i < (1 << ((int)(msks).size())); i++) {
      if (!(i & (1 << j))) {
        add(a[i], a[i | (1 << j)]);
      }
    }
  }
  for (int j = 0; j < ((int)(msks).size()); j++) {
    for (int i = 0; i < (1 << ((int)(msks).size())); i++) {
      if (!(i & (1 << j))) {
        add(b[i], b[i | (1 << j)]);
      }
    }
  }
  for (int i = 0; i < (1 << ((int)(msks).size())); i++) {
    a[i] = mul(a[i], b[i]);
  }
  for (int j = 0; j < ((int)(msks).size()); j++) {
    for (int i = 0; i < (1 << ((int)(msks).size())); i++) {
      if (!(i & (1 << j))) {
        add(a[i], mod - a[i | (1 << j)]);
      }
    }
  }
  int res = 0;
  for (int i = 1; i < (1 << ((int)(msks).size())); i++) {
    add(res, a[i]);
  }
  printf("%d\n", res);
}
int main() {
  precalc();
  while (read()) {
    solve();
  }
  return 0;
}