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;
template <int MOD>
struct ModInt {
  using Mint = ModInt;
  int val;
  ModInt(int64_t __val = 0) { fix(__val % MOD + MOD); }
  Mint& fix(int __val) {
    val = __val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  explicit operator int() { return val; }
  Mint operator+(const Mint& mt) const { return Mint().fix(val + mt.val); }
  Mint operator-(const Mint& mt) const {
    return Mint().fix(val - mt.val + MOD);
  }
  Mint operator*(const Mint& mt) const {
    return Mint().fix(int64_t(val) * mt.val % MOD + MOD);
  }
  Mint& operator+=(const Mint& mt) { return *this = *this + mt; }
  Mint& operator-=(const Mint& mt) { return *this = *this - mt; }
  Mint& operator*=(const Mint& mt) { return *this = *this * mt; }
  Mint pow(int y) const {
    Mint x = *this;
    Mint ans(1);
    for (; y > 0; y >>= 1, x *= x) {
      if (y & 1) ans *= x;
    }
    return ans;
  }
  Mint operator-() const { return Mint().fix(MOD - val); }
  Mint inv() const { return pow(MOD - 2); }
  Mint operator/(const Mint& mt) const { return *this * mt.inv(); }
  Mint& operator/=(const Mint& mt) const { return *this / mt; }
  friend ostream& operator<<(ostream& os, const Mint& mt) {
    return os << mt.val;
  }
};
using Mint = ModInt<1000000007>;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<vector<Mint>> p(6, vector<Mint>(6));
  for (int i = 0; i < 6; ++i) {
    if (i < N) {
      for (int j = 0; j < N; ++j) {
        int _p;
        cin >> _p;
        p[i][j] = Mint(_p) / Mint(100);
      }
    } else
      p[i][i] = 1;
  }
  vector<Mint> lval(1 << 20);
  vector<Mint> rval(1 << 20);
  for (int mask = 0; mask < (1 << 18); ++mask) {
    Mint prob = 1;
    for (int z = 0; z < 18; ++z) {
      if (mask & (1 << z))
        prob *= p[z / 6][z % 6];
      else
        prob *= (Mint(1) - p[z / 6][z % 6]);
    }
    int idx = 0;
    int state = 0;
    for (int a = 0; a < 6; ++a) {
      for (int b = a + 1; b < 6; ++b) {
        for (int c = b + 1; c < 6; ++c) {
          bool good = false;
          int arr[3] = {a, b, c};
          do {
            bool ok = true;
            for (int z : {arr[0], 6 + arr[1], 12 + arr[2]}) {
              if (!(mask & (1 << z))) ok = false;
            }
            if (ok) good = true;
          } while (next_permutation(arr, arr + 3));
          if (good) state |= (1 << idx);
          idx++;
        }
      }
    }
    lval[state] += prob;
  }
  for (int mask = 0; mask < (1 << 18); ++mask) {
    Mint prob = 1;
    for (int z = 0; z < 18; ++z)
      if (mask & (1 << z)) {
        prob *= p[z / 6 + 3][z % 6];
      } else
        prob *= (Mint(1) - p[z / 6 + 3][z % 6]);
    int idx = 0;
    int state = 0;
    for (int a = 0; a < 6; ++a) {
      for (int b = a + 1; b < 6; ++b) {
        for (int c = b + 1; c < 6; ++c) {
          bool good = false;
          int arr[3];
          int sz = 0;
          for (int i = 0; i < 6; ++i)
            if (i != a && i != b && i != c) arr[sz++] = i;
          do {
            bool ok = true;
            for (int z : {arr[0], 6 + arr[1], 12 + arr[2]}) {
              if (!(mask & (1 << z))) ok = false;
            }
            if (ok) good = true;
          } while (next_permutation(arr, arr + 3));
          if (good) state |= (1 << idx);
          idx++;
        }
      }
    }
    rval[state] += prob;
  }
  for (int i = 0; i < 20; ++i) {
    for (int j = 0; j < (1 << 20); ++j)
      if (!(j & (1 << i))) rval[j ^ (1 << i)] += rval[j];
  }
  Mint ans = 1;
  for (int i = 0; i < (1 << 20); ++i)
    ans -= lval[i] * rval[((1 << 20) - 1) ^ i];
  cout << ans << '\n';
  return 0;
}