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 <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
string direc = "URDL";
const long long MOD2 = (long long)1000000007 * (long long)1000000007;
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 1000000007) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
unordered_map<bitset<128>, int> mp;
int cnt, dp[65000][130];
int dfs(bitset<128> s) {
  if (mp.find(s) != mp.end()) return mp[s];
  int z = cnt++;
  mp[s] = z;
  for (int(i) = 0; (i) < (int)(1 << n); (i)++) {
    bitset<128> t = s;
    for (int(j) = 0; (j) < (int)(1 << n); (j)++)
      if (!t[j]) {
        for (int k = i & j; k; k ^= k & -k)
          if (s[j ^ (k & -k)]) {
            t[j] = 1;
            break;
          }
      }
    dp[z][i] = dfs(t);
  }
  return z;
}
int p[10][10], q[10][130], f[9][65000];
void fmain(int tid) {
  scanf("%d", &n);
  dfs(1);
  int inv = fastPow(100, 1000000007 - 2);
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    for (int(j) = 0; (j) < (int)(n); (j)++) {
      scanf("%d", &p[i][j]);
      p[i][j] = (long long)p[i][j] * inv % 1000000007;
    }
  }
  for (int(j) = 0; (j) < (int)(n); (j)++) {
    for (int(s) = 0; (s) < (int)(1 << n); (s)++) {
      q[j][s] = 1;
      for (int(z) = 0; (z) < (int)(n); (z)++)
        if (s & (1 << z))
          q[j][s] = (long long)q[j][s] * p[z][j] % 1000000007;
        else
          q[j][s] =
              (long long)q[j][s] * (1000000007 + 1 - p[z][j]) % 1000000007;
    }
  }
  f[0][0] = 1;
  for (int(i) = 0; (i) < (int)(n); (i)++)
    for (int(j) = 0; (j) < (int)(cnt); (j)++) {
      for (int(k) = 0; (k) < (int)(1 << n); (k)++) {
        addmod(f[i + 1][dp[j][k]], (long long)f[i][j] * q[i][k] % 1000000007);
      }
    }
  bitset<128> z;
  for (int(i) = 0; (i) < (int)(1 << n); (i)++) z[i] = 1;
  printf("%d\n", f[n][mp[z]]);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}